We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

merge (move) posts to another thread (how I did it) - Forum | Forum

Matthew
Matthew Nov 6 '13
There is no built-in way to do this, but I figured I'd give it a shot in the database.

Two topics, but with a number of users and posts. A number of users posted in the incorrect thread and I needed to move the posts into the proper thread.
Let's call them "incorrect topic" and "proper topic"

DATABASE:
_oxw1
TABLES:
forum_post
forum_post_attachment
forum_topic



I opened the forum_topic table and noted the topicId of the "incorrect topic" and the id of the "proper topic"

I opened the forum_post table and located the posts id's I needed to move.  I was reassured I was on the right track when I noticed that they had the topicId of the "incorrect topic".

Next I edited all the posts that needed moving, changing the incorrect topicId to the proper topicId.

That was it, seemed to work.

Now I needed to reorder the posts (normally wouldn't have to do that in a simple merge). I locked the topic and opened the forum_post table and had to change the actual id's of the posts to place them in the desired order by id. This messed up the post's attachments (the attachments are "attached" to the post id apparently).  I remembered which post had the attachments originally (lucky), so I located that post in the forum_post table and noted it's postId.  Then I opened the forum_post_attachment table, located the postId that incorrectly contained the attachments and changed the postId to reflect the proper postId.

Then I unlocked the topics.

PROBLEMS NOTED:
1. The "last reply" was wrong, had to change the "last post" id in the forum_topic table...we will see if it updates correctly
3. to fix stats, had to run UPDATE `forum_read_topic` SET `topicId`=[proper topicid] WHERE `topicId`=[incorrect topicid]. Not sure if that did it.
2. I did this same procedure with another thread, moving ALL the posts to another topic. This resulted in the empty topic being listed in the forum topic list, but got a 404 since there was actually no posts anymore. (I assume that is why, anyway).  I simply went to the forum_topic table and deleted the old empty topic from the table.

Do you see any problems with what I did? Everything seems to work still, and I don't see any adverse effects.

On a related note: man, would a 'merge topics' tool be SWEET! ;)




The Forum post is edited by Matthew Nov 6 '13
You do not have permission to reply this topic