Script to add a board

Started by deathwantsme, November 30, 2005, 05:48:59 PM

Previous topic - Next topic

deathwantsme

I was wondering if there is a way to make a script that when registering a new member the forum makes a new board called there user name. The member would be the moderator of that board, and a set of permissions would be set on who can/cannot read the section. If so, what language would you need to do it in an about how hard do you think it would be to make/ what level of coding experiance do you think would be needed?

Dannii

You've kind of got that the wrong way around. The forum is the top level thing. Boards go inside it.

Yes a script for that would be possible, but I wouldn't know how to do it. You'd have to duplicate the new board functions etc.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

deathwantsme

Sounds like a big challange. What languages would you need to know to do that?

Dannii

php only.
Actually it might not be too hard, but I'd have to ask if it's really necessary...

Okay ManageBoards.php (i think it's called). There should be a function called new_board or the like in it. You'll want to copy that and add it to a file called... deathwantsmenewscript.php or something. doesn't really matter.
Now that function normally get's all that it needs from the form. Instead you would want to hardcode the category, visibility options etc etc so that all it needs is the ID of the new user. At the end of the registration code (or maybe when they validate), you then add the moderator, which is actually very easy. You won't need to change anything for that.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

deathwantsme

#4
Its not "nessicary" but im looking at creating a mod that puts a journal feature on your board. Each time a member registers, the forum makes them a journal forum that is only accessable by URL and by a button in the header. Knowing how to do this really helps the whole process and makes it easier so i can help give the SMF community something rather cool to add to their forums.


// Some things that need to be setup for a new board.
$curBoard = array(
'memberGroups' => array(0, -1),
'category' => (int) $_REQUEST['cat']
);
$context['board_order'] = array();
$context['board'] = array(
'is_new' => true,
'id' => 0,
'name' => $txt['mboards_new_board_name'],
'description' => '',
'count_posts' => 1,
'theme' => 0,
'override_theme' => 0,
'category' => (int) $_REQUEST['cat'],
'no_children' => true,
'permission_mode' => 'normal',
);
}
else
{
// Just some easy shortcuts.
$curBoard = &$boards[$_REQUEST['boardid']];
$context['board'] = $boards[$_REQUEST['boardid']];
$context['board']['name'] = htmlspecialchars($context['board']['name']);
$context['board']['description'] = htmlspecialchars($context['board']['description']);
$context['board']['no_children'] = empty($boards[$_REQUEST['boardid']]['tree']['children']);
}


Is what the new board stuff is. When i have it make the new board, can i change the word board to something other then board so i can use the members ID to be their boards ID? Currently it would show up like http://www.hazelwoodwest.kolhoster.com/forum/index.php?board=120.0 I would like something like http://www.hazelwoodwest.kolhoster.com/forum/index.php?member=120.0 instead.

Dannii

You could do that but I think it would cause problems. What about for existing members and boards who don't match?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

deathwantsme

Currently only 38 of them and i can manualy do that. shant be that hard i dont think. This is also going on a brand new forum im making, so it wont be a bother with that.

Dannii

Well that would be possible to redirect index.php?member= to index.php?board=
I would save a few boards, maybe 20, beforehand as well. You'd need to make 20 dummy forum accounts to then.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

deathwantsme

Im saying i could manualy make each board via the manage boards thinger, maybe not, but i would assume its possible. So what exactly do i need to change with that code i posted?

Nomina

Quote from: deathwantsme on November 30, 2005, 05:48:59 PM
I was wondering if there is a way to make a script that when registering a new member the forum makes a new board called there user name. The member would be the moderator of that board, and a set of permissions would be set on who can/cannot read the section.

I'm looking for a way to do precisely what you've described once the registration request has been validated.  It would help certainly help streamline what is now an easy, but tedious task.  Any progress??

deathwantsme

Dont know php. Im going to ask a teacher at my school about it some time soon, but right now, im just trying to fix what ive messed up while TRYING to do this and other things. Its a pain in the arse to say the least.

Advertisement: