Sticky becomes unstuck when thread is edited? (Bugs)

by Magma, Sunday, March 15, 2015, 05:31 (924 days ago)

I don't know if this is a bug or not but:

User creates a thread, moderator sticks the thread .... if user then edits the thread at a later time it becomes unstuck and moderator needs to stick the thread once again. Is this by design?

Avatar

Sticky becomes unstuck when thread is edited?

by Milo ⌂, Sunday, March 15, 2015, 09:00 (924 days ago) @ Magma

Hi Magman,

I don't know if this is a bug or not but:

I think, it is a bug and should be fixed in the next version. ;-)

I took a look to the source code and found the reason of this behaviour in postinc.inc.php. The sticky state is check for mods and admins but not for a user. In case of an user, the state is (re)set to zero.

Are you familiar with PHP? You have to change one line in the posting.inc.php file. Look for the following statement (near line 972):

       if($field['user_id']>0) // posting of a registered user edited
        {
         @mysql_query("UPDATE ".$db_settings['forum_table']." SET time=time, last_reply=last_reply, edited=".$edited_query.", edited_by=".$edited_by_query.", subject='".mysql_real_escape_string($subject)."', category=".intval($p_category).", email='".mysql_real_escape_string($email)."', hp='".mysql_real_escape_string($hp)."', location='".mysql_real_escape_string($location)."', text='".mysql_real_escape_string($text)."', tags='".mysql_real_escape_string($s_tags)."', email_notification='".intval($email_notification)."', show_signature='".intval($show_signature)."', sticky=".intval($sticky)." WHERE id=".intval($id), $connid);
        }

Replace it by the following code:

       if($field['user_id']>0) // posting of a registered user edited
        {
         @mysql_query("UPDATE ".$db_settings['forum_table']." SET time=time, last_reply=last_reply, edited=".$edited_query.", edited_by=".$edited_by_query.", subject='".mysql_real_escape_string($subject)."', category=".intval($p_category).", email='".mysql_real_escape_string($email)."', hp='".mysql_real_escape_string($hp)."', location='".mysql_real_escape_string($location)."', text='".mysql_real_escape_string($text)."', tags='".mysql_real_escape_string($s_tags)."', email_notification='".intval($email_notification)."', show_signature='".intval($show_signature)."' ". ((isset($_SESSION[$settings['session_prefix'].'user_type']) && $_SESSION[$settings['session_prefix'].'user_type'] > 0) ? ", sticky=".intval($sticky) : "") ." WHERE id=".intval($id), $connid);
         //@mysql_query("UPDATE ".$db_settings['forum_table']." SET time=time, last_reply=last_reply, edited=".$edited_query.", edited_by=".$edited_by_query.", subject='".mysql_real_escape_string($subject)."', category=".intval($p_category).", email='".mysql_real_escape_string($email)."', hp='".mysql_real_escape_string($hp)."', location='".mysql_real_escape_string($location)."', text='".mysql_real_escape_string($text)."', tags='".mysql_real_escape_string($s_tags)."', email_notification='".intval($email_notification)."', show_signature='".intval($show_signature)."', sticky=".intval($sticky)." WHERE id=".intval($id), $connid);
        }

regards
Micha

--
Surveyor-Software: Geodetic Network Adjustment & Deformation-Analysis and Transformation

Tags:
posting.inc.php, sticky, bug

RSS Feed of thread
powered by my little forum