bira
12-29-2001, 10:00 PM
This was requested on vbulletin.com and it's a very simple hack,
which essentially combines the split and the merge admin options :)
Open postings.php and find (Around lines 756-757):
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,views,i conid,notes,visible) VALUES (NULL,'".addslashes($title)."','".addslashes($threadinfo[lastpost])."','".addslashes($threadinfo[forumid])."','".addslashes($threadinfo[open])."','".addslashes($threadinfo[replycount])."','".addslashes($threadinfo[postusername])."','".addslashes($threadinfo[postuserid])."','".addslashes($threadinfo[lastposter])."','".addslashes($threadinfo[dateline])."','".addslashes($threadinfo[views])."','".addslashes($threadinfo[iconid])."','Thread split from threadid $threadid by ".addslashes($bbuserinfo['username'])." on ".vbdate($dateformat." ".$timeformat,time()).". ".addslashes($threadinfo[notes])."','".addslashes($threadinfo[visible])."')");
$newthreadid=$DB_site->insert_id();
Replace it with:
// move posts from one thread to another
if(trim($movetothread)=="") {
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,views,i conid,notes,visible) VALUES (NULL,'".addslashes($title)."','".addslashes($threadinfo[lastpost])."','".addslashes($threadinfo[forumid])."','".addslashes($threadinfo[open])."','".addslashes($threadinfo[replycount])."','".addslashes($threadinfo[postusername])."','".addslashes($threadinfo[postuserid])."','".addslashes($threadinfo[lastposter])."','".addslashes($threadinfo[dateline])."','".addslashes($threadinfo[views])."','".addslashes($threadinfo[iconid])."','Thread split from threadid $threadid by ".addslashes($bbuserinfo['username'])." on ".vbdate($dateformat." ".$timeformat,time()).". ".addslashes($threadinfo[notes])."','".addslashes($threadinfo[visible])."')");
$newthreadid=$DB_site->insert_id();
} else {
// get other threadid
$getthreadid=intval(substr($movetothread,strpos($m ovetothread,"threadid=")+9));
if ($getthreadid==0) {
$getpostid=intval(substr($movetothread,strpos($mov etothread,"postid=")+7));
if ($getpostid==0) {
// do invalid url
eval("standarderror(\"".gettemplate("error_mergebadurl")."\");");
exit;
}
$getpostid=verifyid("post",$getpostid,0);
if ($getpostid==0) {
// do invalid url
eval("standarderror(\"".gettemplate("error_mergebadurl")."\");");
exit;
}
$postinfo=getpostinfo($getpostid);
$newthreadid=$postinfo[threadid];
} else {
$getthreadid=verifyid("thread",$getthreadid,0);
if ($getthreadid==0) {
// do invalid url
eval("standarderror(\"".gettemplate("error_mergebadurl")."\");");
exit;
}
$newthreadid=$getthreadid;
}
}
// / move posts from one thread to another
Save and upload.
Open template threads_splitthread and find:
$postbits
Right BEFORE it add:
<tr>
<td bgcolor="{ secondaltcolor }"><normalfont><b>OR Merge Posts into Thread:</b></normalfont></td>
<td bgcolor="{ secondaltcolor }"><normalfont><input type="text" class="bginput" name="movetothread" size="55"></normalfont></td>
</tr>
(remove the space after and before { } in the above code)
That's it :)
Cheers,
Bira
<< edit: you don't have to put spaces in between the {replacementvars} if you have checked 'disable smilies in this post ;) >>
<< edit 2: ok apparently i lied...chen did you remove that here? >>
which essentially combines the split and the merge admin options :)
Open postings.php and find (Around lines 756-757):
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,views,i conid,notes,visible) VALUES (NULL,'".addslashes($title)."','".addslashes($threadinfo[lastpost])."','".addslashes($threadinfo[forumid])."','".addslashes($threadinfo[open])."','".addslashes($threadinfo[replycount])."','".addslashes($threadinfo[postusername])."','".addslashes($threadinfo[postuserid])."','".addslashes($threadinfo[lastposter])."','".addslashes($threadinfo[dateline])."','".addslashes($threadinfo[views])."','".addslashes($threadinfo[iconid])."','Thread split from threadid $threadid by ".addslashes($bbuserinfo['username'])." on ".vbdate($dateformat." ".$timeformat,time()).". ".addslashes($threadinfo[notes])."','".addslashes($threadinfo[visible])."')");
$newthreadid=$DB_site->insert_id();
Replace it with:
// move posts from one thread to another
if(trim($movetothread)=="") {
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,views,i conid,notes,visible) VALUES (NULL,'".addslashes($title)."','".addslashes($threadinfo[lastpost])."','".addslashes($threadinfo[forumid])."','".addslashes($threadinfo[open])."','".addslashes($threadinfo[replycount])."','".addslashes($threadinfo[postusername])."','".addslashes($threadinfo[postuserid])."','".addslashes($threadinfo[lastposter])."','".addslashes($threadinfo[dateline])."','".addslashes($threadinfo[views])."','".addslashes($threadinfo[iconid])."','Thread split from threadid $threadid by ".addslashes($bbuserinfo['username'])." on ".vbdate($dateformat." ".$timeformat,time()).". ".addslashes($threadinfo[notes])."','".addslashes($threadinfo[visible])."')");
$newthreadid=$DB_site->insert_id();
} else {
// get other threadid
$getthreadid=intval(substr($movetothread,strpos($m ovetothread,"threadid=")+9));
if ($getthreadid==0) {
$getpostid=intval(substr($movetothread,strpos($mov etothread,"postid=")+7));
if ($getpostid==0) {
// do invalid url
eval("standarderror(\"".gettemplate("error_mergebadurl")."\");");
exit;
}
$getpostid=verifyid("post",$getpostid,0);
if ($getpostid==0) {
// do invalid url
eval("standarderror(\"".gettemplate("error_mergebadurl")."\");");
exit;
}
$postinfo=getpostinfo($getpostid);
$newthreadid=$postinfo[threadid];
} else {
$getthreadid=verifyid("thread",$getthreadid,0);
if ($getthreadid==0) {
// do invalid url
eval("standarderror(\"".gettemplate("error_mergebadurl")."\");");
exit;
}
$newthreadid=$getthreadid;
}
}
// / move posts from one thread to another
Save and upload.
Open template threads_splitthread and find:
$postbits
Right BEFORE it add:
<tr>
<td bgcolor="{ secondaltcolor }"><normalfont><b>OR Merge Posts into Thread:</b></normalfont></td>
<td bgcolor="{ secondaltcolor }"><normalfont><input type="text" class="bginput" name="movetothread" size="55"></normalfont></td>
</tr>
(remove the space after and before { } in the above code)
That's it :)
Cheers,
Bira
<< edit: you don't have to put spaces in between the {replacementvars} if you have checked 'disable smilies in this post ;) >>
<< edit 2: ok apparently i lied...chen did you remove that here? >>