Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 379
0 Users 13 Guests Online

Unstick threads

Requested by zackcez

Ok open forum_mod.php

Find:

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


Add after:

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


Now in forum.php

find:
PHP Code
1
2
case 'forumdisplay':


This is where we will be working

Now in that case find:

PHP Code
1
2
3
4
5
if ($logged[userlevel] == '4' || $logged[userlevel] == '6')
{
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>");
}


And change it to:

PHP Code
1
2
3
4
5
if ($logged[userlevel] == '4' || $logged[userlevel] == '6')
{
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>");
}


And that's it not tested as its simple but didnt really change alot so it should work.
new2old
Author:
Views:
3342
Rating:
There are currently no comments for this tutorial.