######################################
[> Title: Board Change Function
[> Author: Cybermaster
[> Scripted for: Gesior's Simple forum script
[> Requires: [Gesior Forum] Sticky Threads Function
[> Coding: PHP+XHTML
[> Revision: 0.1
\_______________________________________________/
Next one:wub:
Again, Thanks to Absolute Mango Couldn't finish it without his help.
Description
This new function allows moderators to move a thread to a different board from where it is.
The function is clearly detailed. After the moderator moves the thread, will be redirected to the new board.
Preview
-------------------------------------------------------------------------------------------------------------------------------------------------------
Setup
STEP 1 (MODIFY FORUM.PHP)
LET'S SEE, OPEN "htdocs/forum.php" AND JUMP TO THE FIRST...
BELOW IT, YOU WILL SEE:
CHANGE THAT $MAINCONTENT TO:
WELL ACTUALLY THIS IS THE ONLY NEW THING:
STEP 2 (ADD MY FUNCTION)
Before
You add:
Yeh, this one was quick.
:ninja:End of the line.
[> Title: Board Change Function
[> Author: Cybermaster
[> Scripted for: Gesior's Simple forum script
[> Requires: [Gesior Forum] Sticky Threads Function
[> Coding: PHP+XHTML
[> Revision: 0.1
\_______________________________________________/
Next one:wub:
Again, Thanks to Absolute Mango Couldn't finish it without his help.
Description
This new function allows moderators to move a thread to a different board from where it is.
The function is clearly detailed. After the moderator moves the thread, will be redirected to the new board.
Preview
-------------------------------------------------------------------------------------------------------------------------------------------------------
Setup
STEP 1 (MODIFY FORUM.PHP)
LET'S SEE, OPEN "htdocs/forum.php" AND JUMP TO THE FIRST...
PHP:
if($logged && $group_id_of_acc_logged >= $group_not_blocked)
BELOW IT, YOU WILL SEE:
Code:
$main_content .= '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><span style="color:red">[REMOVE]</span></a> <a href="?subtopic=forum&action=stick_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want stick or unstick thread > '.$thread['post_topic'].' <?\')">'.$stix.'</a><br/>';';
CHANGE THAT $MAINCONTENT TO:
Code:
$main_content .= '<a href="?subtopic=forum&action=stick_post&id='.$thread['id'].'")">'.$stix.'</a> <a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a> <a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><span style="color:red">[REMOVE]</span></a><br/>';
WELL ACTUALLY THIS IS THE ONLY NEW THING:
Code:
<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>
STEP 2 (ADD MY FUNCTION)
Before
PHP:
if($action == 'remove_post')
You add:
PHP:
//Board Change Function. Scripted by Cybermaster and Absolute Mango
if($action == 'move_thread')
{
if($logged && $group_id_of_acc_logged >= $group_not_blocked)
{
$id = (int) $_REQUEST['id'];
$post = $SQL->query("SELECT `id`, `section`, `first_post`, `post_topic`, `author_guid` FROM `z_forum` WHERE `id` = ".$id." LIMIT 1")->fetch();
$name= $SQL->query("SELECT `name` FROM `players` WHERE `id` = ".$post['author_guid']." ")->fetch();
if($post['id'] == $id)
{
if($post['id'] == $post['first_post'])
{
$main_content .= '<br/><table bgcolor='.$config['site']['vdarkborder'].' border=0 cellpadding=2 cellspacing=0 width=100%>
<tr bgcolor='.$config['site']['vdarkborder'].'><td class=white colspan=5><B>Move thread to another board</B></td></tr>
<tr><td><table border=0 cellpadding=3 cellspacing=1 width=100%>
<tr bgcolor='.$config['site']['lightborder'].'><td>
<FORM ACTION="" METHOD="GET">
<input type="hidden" name="subtopic" value="forum" />
<input type="hidden" name="action" value="moved_thread" />
<input type="hidden" name="id" value="'.$post['id'].'" />
<strong>THREAD:</strong> '.$post['post_topic'].'
<br/><strong>AUTHOR:</strong> '.$name[0].'
<br/><strong>BOARD:</strong> '.$sections[$post['section']].'<br/>
<br/><strong>Select the new board: </strong><SELECT NAME=sektion>';
foreach($sections as $id => $section) { $main_content .= '<OPTION value="'.$id.'">'.$section.'</OPTION>'; } $main_content .= '</SELECT>
<INPUT TYPE="submit" VALUE="Move Thread"></FORM>
<form action="?subtopic=forum&action=show_board&id='.$post['section'].'" method="POST">
<input type="submit" value="Cancel"></form></td></tr></table></td></tr></table>';
}
}
else
$main_content .= 'Post with ID '.$id.' does not exist.';
}
else
$main_content .= 'You are not logged in or you are not moderator.';
}
if($action == 'moved_thread')
{
if($logged && $group_id_of_acc_logged >= $group_not_blocked)
{
$id = (int) $_REQUEST['id'];
$board = (int) $_REQUEST['sektion'];
$post = $SQL->query("SELECT `id`, `sticky`, `first_post`, `section` FROM `z_forum` WHERE `id` = ".$id." LIMIT 1")->fetch();
if($post['id'] == $id)
{
if($post['id'] == $post['first_post'])
{
$SQL->query("UPDATE `z_forum` SET `section` = ".$board." WHERE `id` = ".$post['id']."") or die(mysql_error());
$nPost = $SQL->query( 'SELECT `section` FROM `z_forum` WHERE `id` = \''.$id.'\' LIMIT 1;' )->fetch();
header('Location: ?subtopic=forum&action=show_board&id='.$nPost['section']);
}
}
else
$main_content .= 'Post with ID '.$id.' does not exist.';
}
else
$main_content .= 'You are not logged in or you are not moderator.';
}
##>
Yeh, this one was quick.
:ninja:End of the line.
Last edited: