Could someone tell me if it is possible to write a MySQL sql statement to insert a group of boards into a site. I would like to create individual boards for each US state and some sub-sets within the states and I don't look forward to the tedium of doing this through the user interface.
Any help would be appreciated.
It is possible, yes. How proficient are you with mysql?
proficient enough to not try anything on a production system... If I can make it work in test, then I'd give it a go on prod, after a full backup, of course.
At the very least you will need to insert into the boards table, perhaps the categories table as well. You may need to pre-prepare your data for ordering and subboard purposes as well, so you know what the other board IDs are. But, if you do it correctly, it should work.
It might be easier to do something with one of SMF's functions:
http://support.simplemachines.org/function_db/index.php?action=view_function;function=9
http://support.simplemachines.org/function_db/index.php?action=view_function;function=118
Thanks for the replies.
Huw: Can you provide an example of the input?
Thanks
Say you had already made a category for these boards and then had all the US states in an array:
Example:
$usstates = array('New Jersey', 'New York');]
You could do:
require('/path/to/ssi.php');
require('/path/to/Sources/Subs-Boards.php');
$boardoptions = array (
'board_name' => 'name',
'inherit_permissions' => false,
'move_to' => 'no',
'target_category' => 1, //Change number to the category ID
)
foreach($usstate as $state)
{
$boardoptions['board_name'] = $state;
createboard($boardoptions);
}
I haven't tested this code but I think it should work :)
will throw an error if you try to direct load Subs-Boards, i believe.
add define('SMF', '1'); before you do anything.
Lainaus käyttäjältä: metallica48423 - huhtikuu 03, 2008, 04:27:46 IP
will throw an error if you try to direct load Subs-Boards, i believe.
add define('SMF', '1'); before you do anything.
AFAIK this is already defined in SSI.php
Hm. Possibly. Its been awhile since i've done anything like this in conjunction with SSI :P
Cool... thanks for the reply. I'll give it a shot and report on the results.