• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Gesior Forum] Board Change Function (move that thread!)

hodleo

Formerly cbrm -Crypto enthusiast, Retired scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,598
Solutions
3
Reaction score
955
Location
Caribbean Sea
######################################
[> 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:D 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
2rpzkn8.jpg

-------------------------------------------------------------------------------------------------------------------------------------------------------
2q9wbbs.jpg


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:&nbsp;</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:
:blink: Someone test this plz.
 
good to hear
:D
the last one is Open|Close Function
 
This script is not able to close and open and the scrinie is such an option ^^
 
This script is not able to close and open and the scrinie is such an option ^^
im finishing that script atm
well, now it just needs the approval of a mod
 
Last edited:
Back
Top