Revision [5066]
This is an old revision of AutomaticUserPageCreation made by NilsLindenberg on 2005-01-24 12:38:31.
Automatic Creation of Userpages on registration
Based on a request in the SuggestionBox, this code will automatically create the page of a newly registered user. Therefore it uses another page, you can choose, as template.
Code is mostly borrowed from Clonepage-handler (thanks!).
Note that this needs some testing, for example it will surely fail, if you don't give the user the right to load (view?) the template-page.
1. Additions to Wikka.config.php
add the following to lines to the config-array:
- "createuserpage" => "on",
- "userpagetemplate" => "YourTemplatePage"
Perhaps you want to change YourTemplatePage to the page which will be the template for the new users.
2. Changes to actions/usersettings.php
add after
// log in
$this->SetUser($this->LoadUser($name));
$this->SetUser($this->LoadUser($name));
$createuserpage = $this->GetConfigValue('createuserpage');
if ($createuserpage == 'on')
{
$from = $this->GetConfigValue('userpagetemplate');
$note = 'automatic creation';
$thepage=$this->LoadPage($from); # load the source page
if ($thepage) $pagecontent = $thepage['body']; # get its content
$this->SavePage($name, $pagecontent, $note); #create target page
}
if ($createuserpage == 'on')
{
$from = $this->GetConfigValue('userpagetemplate');
$note = 'automatic creation';
$thepage=$this->LoadPage($from); # load the source page
if ($thepage) $pagecontent = $thepage['body']; # get its content
$this->SavePage($name, $pagecontent, $note); #create target page
}
CategoryUserContributions