Unstick threads


Requested by zackcez

Ok open forum_mod.php

Find:

PHP Code
  1. case 'sticky':
  2. $id = (int) htmlspecialchars($_GET[id]);
  3. $fetch = mysql_query("SELECT * FROM `forum_thread` WHERE `id` = '$id'");
  4. $thread = mysql_fetch_array($fetch);
  5. if ($thread[sticky] == Yes)
  6. {
  7. echo ("This has already been sticked. <br><a href='javascript: history.go(-1)'>Go back.</a>");
  8. }
  9. else
  10. {
  11. $update = mysql_query("UPDATE `forum_thread` SET `sticky` = 'Yes' WHERE `id` = '$id'");
  12. echo ("Thread has been stickied. <br><a href='javascript: history.go(-1)'>Go back.</a>");
  13. }
  14. break;


Add after:

PHP Code
  1. case 'notsticky':
  2. $id = (int) htmlspecialchars($_GET[id]);
  3. $fetch = mysql_query("SELECT * FROM `forum_thread` WHERE `id` = '$id'");
  4. $thread = mysql_fetch_array($fetch);
  5. if ($thread[sticky] == No)
  6. {
  7. echo ("This is not a sticky thread <br><a href='javascript: history.go(-1)'>Go back.</a>");
  8. }
  9. else
  10. {
  11. $update = mysql_query("UPDATE `forum_thread` SET `sticky` = 'No' WHERE `id` = '$id'");
  12. echo ("Thread Un-Stuck <br><a href='javascript: history.go(-1)'>Go back.</a>");
  13. }
  14. break;


Now in forum.php

find:
PHP Code
  1. case 'forumdisplay':


This is where we will be working

Now in that case find:

PHP Code
  1. if ($logged[userlevel] == '4' || $logged[userlevel] == '6')
  2. {
  3. echo ("<br><a href='forum_mod.php?page=lock&id=$thread[id]'>Lock</a> - <a href='?page=editthread&id=$thread[id]'>Edit</a> - <a href='forum_mod.php?page=sticky&id=$thread[id]'>Sticky</a>");
  4. }


And change it to:

PHP Code
  1. if ($logged[userlevel] == '4' || $logged[userlevel] == '6')
  2. {
  3. echo ("<br><a href='forum_mod.php?page=lock&id=$thread[id]'>Lock</a> - <a href='?page=editthread&id=$thread[id]'>Edit</a> - <a href='forum_mod.php?page=sticky&id=$thread[id]'>Sticky</a> - <a href='forum_mod.php?page=notsticky&id=$thread[id]'>Unstick</a>");
  4. }


And that's it not tested as its simple but didnt really change alot so it should work.
new2old's Avatar
Author:
Views:
4,551
Rating:
There are currently no comments for this tutorial, login or register to leave one.