I need to do this also. Can I just upload the tree to the "Forums" table? Or do I have to worry about other tables?
I tried a manual addition in myPhpAdmin, and it isn't working. I assume that "resetting the reference links" is a missing step, but I have no idea to what you are referring...
I think I can generate the forums with a script, then copy them into Excel, then Insert them into the Forums table.
In my testing with manual record insertion in myPhpAdmin, the forums show the correct tree structure to the user, but not in the admin CP.
Looks like running the "Recount & rebuild" > "Rebuild Thread Counters" forced the index to fix itself though...
I use an installation of the forum as a support desk for some clients which is why I need to have the same tree structure repeated per client.
I created a mysql backup of the mybb14_forums table and removed the create table sql statement which left me with the insert into command which recreates the entire forum structure. e.g.
INSERT INTO mybb14_forums
(fid
, name
, description
, linkto
, type
, pid
, parentlist
, disporder
, active
, open
, threads
, posts
, lastpost
, lastposter
, lastposteruid
, lastposttid
, lastpostsubject
, allowhtml
, allowmycode
, allowsmilies
, allowimgcode
, allowpicons
, allowtratings
, status
, usepostcounts
, password
, showinjump
, modposts
, modthreads
, mod_edit_posts
, modattachments
, style
, overridestyle
, rulestype
, rulestitle
, rules
, unapprovedthreads
, unapprovedposts
, defaultdatecut
, defaultsortby
, defaultsortorder
) VALUES (1, '/Contractor Information System & Support', '', '', 'c', 0, '1', 1, 1, 1, 0, 0, 0, '', 0, 0, '', 1, 1, 1, 1, 1, 1, 1, 1, '', 1, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, '', ''),
(2, 'Client support desk', '', '', 'f', 1, '1,2', 1, 1, 1, 2, 2, 1234188279, 'GerryK', 1, 2, 'Hi', 0, 1, 1, 1, 1, 1, 1, 1, '', 1, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, '', ''),
(49, 'Purchase Orders', '', '', 'f', 33, '1,2,29,30,33,49', 1, 1, 1, 0, 0, 0, '', 0, 0, '', 0, 1, 1, 1, 1, 1, 1, 1, '', 1, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, '', '')
etc.
The key field is the parentlist field which states the link between the forum and the entire tree. To copy an entire tree structure modify the sql statement to contain only the branch and sub-branches that you want to copy. Change the forum ID (fid) to a new, not curently used number for each sub forum and rereference the parentlist field for each forum.
Paste the new code into phpmyadmin and run it. There is no need to rebuild as the new structure will be created from the fid and parentlist fields.
It took me a while to work this thru but afer a few goes it only takes a few minutes per copy and it does work.
I'll add a brief description of what I've done as well, in case it helps someone down the road.
I generate the fields with a VBA script in Microsoft Access (because that's what I'm comfortable with). I copy the records to Excel, delete the header row, fill down on the extra fields that I didn't generate in Access and then export to a .cvs file.
In myPhpAdmin, I Import, changing the " ; " separator to a " , ", specify the file, "replace table data with file", "CSV using LOAD DATA", and paste the column names (several ways to get these, your method above is much easier than the way I used.