Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Merge forums

Quote Reply
Merge forums
This is probably belongs in the SQL section, but does anybody have a SQL template (plug in forum numbers and execute) to merge two forums?
Quote Reply
Re: [ArmyAirForces] Merge forums In reply to
You can use this query:

UPDATE gforum_Post set forum_id_fk = 123 WHERE forum_id_fk = 456

Replacing 123 with the new forum, and 456 with the old forum. You may get results a little bit screwed up in the forum listings - the latest post information may be wrong; an easy way to fix this is to post into each forum, then delete (full delete - ie. "Remove") those two.

You could do this using Gossamer Forum code (from a global, plugin, new CGI script, etc.) by doing:

$DB->table('Post')->update({ forum_id_fk => 123 } => { forum_id_fk => 456 });

Doing it this way you won't have to worry about the forum display being messed up - but it's more effort since you'll have to put the code somewhere for it to run.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Merge forums In reply to
Thanks Jason,

My intent is to merge a couple of old forums to a new forum, and then delete the old ones.

-Scott
Quote Reply
Re: [ArmyAirForces] Merge forums In reply to
Alright, the code to do two forums at once would be like this:

UPDATE gforum_Post set forum_id_fk = 123 WHERE forum_id_fk IN (456, 789)

456 and 789 are the two old forum ID's.

Using Gossamer Forum's interface, you would do:

$DB->table('Post')->update({ forum_id_fk => 123 } => { forum_id_fk => [456, 789] });

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com