Topic: message edit timer

I am loking for a working mod for 1.2.20 that allows users to edit the message for a short period.
The one i did find, so far, dont work.

Re: message edit timer

Here is the simple patch:

Index: edit.php
===================================================================
--- edit.php    (revision 516)
+++ edit.php    (working copy)
@@ -36,7 +36,7 @@
     message($lang_common['Bad request']);
 
 // Fetch some info about the post, the topic and the forum
-$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
+$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.posted AS post_posted, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
 if (!$db->num_rows($result))
     message($lang_common['Bad request']);
 
@@ -53,8 +53,9 @@
 $can_edit_subject = ($id == $topic_post_id && (($pun_user['g_edit_subjects_interval'] == '0' || (time() - $cur_post['posted']) < $pun_user['g_edit_subjects_interval']) || $is_admmod)) ? true : false;
 
 // Do we have permission to edit this post?
-if (($pun_user['g_edit_posts'] == '0' ||
-    $cur_post['poster_id'] != $pun_user['id'] ||
+if (((($pun_user['g_edit_posts'] == '0' ||
+    $cur_post['poster_id'] != $pun_user['id']) &&
+    (time() - $cur_post['post_posted']) > 300) ||
     $cur_post['closed'] == '1') &&
     !$is_admmod)
     message($lang_common['No permission']);
Index: viewtopic.php
===================================================================
--- viewtopic.php    (revision 516)
+++ viewtopic.php    (working copy)
@@ -278,7 +278,7 @@
             {
                 if ((($start_from + $post_count) == 1 && $pun_user['g_delete_topics'] == '1') || (($start_from + $post_count) > 1 && $pun_user['g_delete_posts'] == '1'))
                     $post_actions[] = '<li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>';
-                if ($pun_user['g_edit_posts'] == '1')
+                if ($pun_user['g_edit_posts'] == '1' || (time() - $cur_post['posted']) <= 300)
                     $post_actions[] = '<li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>';
             }
Carpe diem

3 (edited by chrisvi 2008-10-27 10:58)

Re: message edit timer

where must i edit this ?
I mean where in the edit.php where in the view.php file must i copy this

Forget this i did read with my eyes closed
This is working with version 1.2.20 ?

4 (edited by Anatoly 2008-10-27 12:32)

Re: message edit timer

I did do it and from that moment you can not vieuw the topic you did enter.
edit PHP

if ($pun_user['g_read_board'] == '0')
    message($lang_common['No view']);


$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if ($id < 1)
     message($lang_common['Bad request']);
 
 // Fetch some info about the post, the topic and the forum
-$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
+$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.posted AS post_posted, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
 if (!$db->num_rows($result))
     message($lang_common['Bad request']);


$cur_post = $db->fetch_assoc($result);
**************************************************************************
// Determine whether this post is the "topic post" or not
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['tid'].' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$topic_post_id = $db->result($result);

$can_edit_subject = ($id == $topic_post_id && (($pun_user['g_edit_subjects_interval'] == '0' || (time() - $cur_post['posted']) < $pun_user['g_edit_subjects_interval']) || $is_admmod)) ? true : false;
 
 // Do we have permission to edit this post?
-if (($pun_user['g_edit_posts'] == '0' ||
-    $cur_post['poster_id'] != $pun_user['id'] ||
+if (((($pun_user['g_edit_posts'] == '0' ||
+    $cur_post['poster_id'] != $pun_user['id']) &&
+    (time() - $cur_post['post_posted']) > 300) ||
     $cur_post['closed'] == '1') &&
     !$is_admmod)
     message($lang_common['No permission']);


// Load the post.php/edit.php language file
********************************************
viewtopic.PHP

// Generation post action array (quote, edit, delete etc.)
    if (!$is_admmod)
    {
        if (!$pun_user['is_guest'])
            $post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>';

        if ($cur_topic['closed'] == '0')
             {
                 if ((($start_from + $post_count) == 1 && $pun_user['g_delete_topics'] == '1') || (($start_from + $post_count) > 1 && $pun_user['g_delete_posts'] == '1'))
                     $post_actions[] = '<li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>';
-                if ($pun_user['g_edit_posts'] == '1')
+                if ($pun_user['g_edit_posts'] == '1' || (time() - $cur_post['posted']) <= 300)
                     $post_actions[] = '<li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>';
             }
    }
    else
        $post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.$lang_topic['Link separator'].'</li><li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>'.$lang_topic['Link separator'].'</li><li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.$lang_topic['Link separator'].'</li><li class="postquote"><a href="post.php?tid='.$id.'&amp;qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';


    // Switch the background color for every message.
    $bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true;
    $vtbg = ($bg_switch) ? ' roweven' : ' rowodd';

EDIT: Added [code ] tag // Anatoly

Re: message edit timer

chrisvi wrote:

I did do it and from that moment you can not vieuw the topic you did enter.

What do you mean?

Carpe diem

6 (edited by chrisvi 2008-10-27 13:01)

Re: message edit timer

now if a user post a message he push on send and then she sees nothing
if you like i can send the two php files to you.
Maby you see somthing stainge

Re: message edit timer

Strange. My patch has just worked for me on 1.2.20.
Any other mods?
Did you get the idea of the patch? Try to debug the page crushing.

You may send me your files, but we're hardly working on 1.3RC2 right now. I will test them after it is released only.

Carpe diem

8 (edited by chrisvi 2008-10-27 13:19)

Re: message edit timer

no i dont have any idea of it
I am a user who try to get the forum as easy as posible
Debug ?

Re: message edit timer

Will this be a standart option in 1.3 ?

Re: message edit timer

maby i reed it wrong or understatd it wrong

i must remove whats on the lines and past the new lines.
So i start with this lines (who will stay the same)
message($lang_common['Bad request']);
en end  afther message($lang_common['Bad request']); what also stays the same

@@ -36,7 +36,7 @@
     message($lang_common['Bad request']);

// Fetch some info about the post, the topic and the forum
-$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
+$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.posted AS post_posted, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
     message($lang_common['Bad request']);

Re: message edit timer

I did it again and again if you write somthing and you say save you get the redirect and than you get a complete emty page.
The i did look in old messages and the also gave a blanco page

Re: message edit timer

chrisvi wrote:

Will this be a standart option in 1.3 ?

No. But it is pretty simple extension.

Carpe diem

13 (edited by chrisvi 2008-10-27 15:57)

Re: message edit timer

only not for me sad

Re: message edit timer

Also take a look at Edit Grace Period mod.

Extension request for 1.3 added.

Carpe diem

Re: message edit timer

I will try this one also
Only must i allow or disallow the usergroep to edit
I think allow and afther 300 sec this will stop ?

Re: message edit timer

chrisvi wrote:

Only must i allow or disallow the usergroep to edit
I think allow and afther 300 sec this will stop ?

Up to you :)

Carpe diem

Re: message edit timer

No if i want to allow users only to edit there post  for 300 sec must i say yes or No to Edit post

Re: message edit timer

Oke i dit try
If i say no to edit post by the user groep the may not edit for 300 sec
If i say yes to edit the may still edit afther  20 minutes so it dont work

Re: message edit timer

Anything like this for 1.3?
A 1 minute edit period would be great to help users correct typos etc.

20

Re: message edit timer

esupergood wrote:

Anything like this for 1.3?
A 1 minute edit period would be great to help users correct typos etc.


This would be very useful, especially if the period is editable by forum admins

Forum, Art, Architecture, Passion.

Have you ever visited the textpattern forum?

21

Re: message edit timer

colak wrote:
esupergood wrote:

Anything like this for 1.3?
A 1 minute edit period would be great to help users correct typos etc.

This would be very useful, especially if the period is editable by forum admins

http://punbb.informer.com/forums/topic/ … ce-period/ wink

YonasH's repository + Extensions Directory = PunBB Extensions Online Library (in progress....)

Away. I will be back soon.

22

Re: message edit timer

 // Do we have permission to edit this post?
-if (($pun_user['g_edit_posts'] == '0' ||
-    $cur_post['poster_id'] != $pun_user['id'] ||
+if (((($pun_user['g_edit_posts'] == '0' ||
+    $cur_post['poster_id'] != $pun_user['id']) &&
+    (time() - $cur_post['post_posted']) > 300) ||
     $cur_post['closed'] == '1') &&
     !$is_admmod)
     message($lang_common['No permission']);

the above code is wrong
instead

// Do we have permission to edit this post?
if (($pun_user['g_edit_posts'] == '0' ||
    $cur_post['poster_id'] != $pun_user['id'] ||
    $cur_post['closed'] == '1' ||
    time() > ($cur_post['post_posted'] + 600)) &&
    !$is_admmod)
    message($lang_common['No permission1']);

is working