PDA

View Full Version : Move Posts from One Thread to Another


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? >>

Tim Wheatley
12-30-2001, 04:42 PM
This won't work for me, it just splits the thread. What am I meant to put in the move to box? The thread number or subject title?

bira
12-30-2001, 05:03 PM
Tim I take it you never merged threads? :)

This works exactly the same: enter the URL of the destination thread

Tim Wheatley
12-31-2001, 09:06 PM
I should tell you your hack works perfectly then! Thanks. ;)

JJR512
01-02-2002, 05:17 AM
Did I request this? Just wondering. I know I WANTED something like this, and MEANT to request it, I just forget if I actually did, and even if I did, maybe it wasn't mine that you saw...again, just out of curiosity. :)

bira
01-02-2002, 10:53 AM
JJR http://vbulletin.com/forum/showthread.php?s=&threadid=36258 :)

Dalius
01-02-2002, 02:18 PM
Can't we just use Move Thread?

JJR512
01-02-2002, 04:04 PM
Move Thread only moves the entire thread. This hack allows you to move an individual post from one thread to another. Previously, this was only possible if you split the thread in two, with one containing the bulk of the thread, the other containing the one post you wanted moved into another thread; then you had to merge that one-post thread into the thread where you wanted that one post.

Steve_S
01-10-2002, 07:59 AM
Yummy bira :)


Thank you so much. This puppy goes in tomorrow. It's a big time saver for those of us who need to save the original post for legal reasons which is a copy thread and then return to edit the originaal spam thread.

Your hack: You just pluck the sucker out and add it to your spam thread in your private forum. :)

Brilliant!

eva2000
01-10-2002, 08:47 AM
definitely yummy bira! :D

installed and working :)

Stretchr
01-16-2002, 02:23 PM
Excellent, bira. Thank you! :cool:

Figment
02-24-2002, 04:57 PM
Thank you, works a treat :)

X-Fan
02-25-2002, 05:01 AM
Great hack, thanks bira!!!

over
02-25-2002, 09:29 AM
excellent hack idea, some peeps in my forum keep on posting a new thread instead of a reply by accident :) gonna install it cheers.

inetd
03-02-2002, 07:51 PM
Good idea and good hack!
Thanks!

Lucky
03-03-2002, 01:27 AM
Works great!!!

Thank you.

LaNder
03-18-2002, 06:17 PM
has anybody tested, if it works with 2.2.4?

i tried it and lost the moved threads - new threadid was set to 0.

had to restore it manually with phpmyadmin.

LaNder

FWC
03-19-2002, 01:21 AM
Originally posted by LaNder
has anybody tested, if it works with 2.2.4?

i tried it and lost the moved threads - new threadid was set to 0.

had to restore it manually with phpmyadmin.


LaNder I'm using it on 2.2.4 with no problem.

LaNder
03-22-2002, 06:21 PM
i checked everything, but i get the same error again und again:

"No thread specified. If you followed a valid link, please notify the webmaster"

http://...../showthread.php?s=&threadid=0

the moved threads a stored in the db with threadid=0

Help needed...

LaNder
04-07-2002, 08:30 AM
i tested it with an unhacked v.2.2.5 bad got the same error :confused:

venomx
04-27-2002, 10:04 PM
I see two of these in 2.2.5... Which do I change?


$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])."')");

venomx
05-04-2002, 07:50 PM
hmm Why when I move a post to a new thread it makes it the top post in the thread?

Smoothie
05-15-2002, 02:27 AM
Can an option be added to copy a post to a new thread, instead of move it?

MarkyBuzz
08-03-2002, 10:17 PM
Thanks Bira,

Works like a charm, and although its yummy too, I`ll stick to Shish Kebabs ;)

WELL DONE!

Jawelin
02-25-2003, 01:51 PM
Could this hack be ported to vb230, where the two rows are innested into an if-clause ?
Thanks, Bira.

opsman
04-04-2003, 11:26 AM
Hi this hack is just what I need but am running 29 so dont have the lines of code to change

any chance of updating :)

Boofo
05-06-2003, 06:04 AM
I'm running it on 2.2.9 and it works great here. ;)

I do have a small problem though. Whenever I move any posts, it makes the thread I moved the posts from a sticky thread. Does anyone have any ideas what might be happening?

crackers8199
07-06-2003, 05:44 PM
Two questions...

1) Does this work on 2.3.0?

2) Is there a way to create a new thread for the posts you want to move using this hack, or do you need to do that manually?

VAN
11-21-2003, 10:59 PM
Has anyone got this to work on 2.3.3?

Mine is creating a new thread instead of placing the selected post(s) in the specified thread.