UBB.Dev
Posted By: Magle A way to merge threads! - 02/24/2004 7:42 PM
Well, did a search here and couldn't find any threads about it, and I can't seem to find any functionality in ubbthreads, so here goes: It would be very nice to have a way to merge two or more threads into one.

Sometimes people start redundant threads. Of course I can lock one of them but sometimes it would be better to merge them into one.

a suggestion for a mod.

It should work in a way so the oldest of the two threads you are merging becomes the new merged thread and the posts inside the thread is of course in order by their post number.
Posted By: Medar Re: A way to merge threads! - 02/25/2004 8:49 PM
I suppose you could do this, it basically involves two fields in the Posts table.

B_Parent
B_Main

Simply by swapping the B_Parent of a number of posts (ie UPDATE w3t_Posts SET B_Parent='x' WHERE B_Parent='x' ), it merge the two threads.

However this is off the top of my head, I have not tested this nor am I 100% sure it would not affect something else.
Posted By: Magle Re: A way to merge threads! - 02/25/2004 9:40 PM
hmmm... anyone's got a test forum and willing to try this out?...I'm a little reluctant to try this experiment myself (yeah, I know I'm a chicken.... )
Posted By: Medar Re: A way to merge threads! - 02/25/2004 10:18 PM
Just test it on one small thread with a few posts each, you should be ok.

Lemme try on my test forum real quick.
Posted By: Medar Re: A way to merge threads! - 02/25/2004 10:48 PM
OK, does not work. Here are the results:

UPDATE w3t_Posts SET B_Main='x' WHERE B_Main='x'

The first 'x' is going to be the main thread, the second 'x' is the thread you are merging into the first.

Doing this DOES work, but it has a side effect. Since every new thread has a B_Parent of '0' (to denote it is a new post and not a reply), you have not changed THAT piece.

So after merging you have TWO first posts. Effectively looking at the forum main page, you will still see both separate threads, but one will now show with all the replies under it, the other will show with NO replies.
___________________________________________________

So to accomplish what you want to do, you have to run two separate UPDATE queries.

For example:

POST1 = Number 23
POST2 = Number 56

You want to take #56 and merge it into #23, effectivly clearing it as a "main" post, and having it and all its replies under the thread for post #23.

UPDATE w3t_Posts SET B_Main='23' WHERE B_Main='56'

UPDATE w3t_Posts SET B_Parent='23',B_Topic='0' WHERE B_Number='56'

Your REPLIES column will not update on the main page until someone makes a new post in the thread. I tested this and it worked for me.
Posted By: Magle Re: A way to merge threads! - 02/26/2004 1:29 AM
Amazing, it works! thanks again!!
Posted By: JoshPet Re: A way to merge threads! - 02/26/2004 5:52 AM
It's very tricky - you also have to make sure to get the B_Replies field set correctly, or the page numbering will be wacked on multi page forums.

Also when I've done this from time to time, it has broken threaded view. Never knew exactly why - but that's been one thing I've noticed the few times I've merged stuff.
© UBB.Developers