Revision [5065]

This is an old revision of AutomaticUserPageCreation made by NilsLindenberg on 2005-01-24 12:38:11.


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:
  1. "createuserpage" => "on",
  2. "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

  1.                                 // log in
  2.                                 $this->SetUser($this->LoadUser($name));

  1.                                 $createuserpage = $this->GetConfigValue('createuserpage');
  2.         if ($createuserpage == 'on')
  3.                                 {
  4.                                             $from = $this->GetConfigValue('userpagetemplate');
  5.                         $note = 'automatic creation';
  6.                         $thepage=$this->LoadPage($from); # load the source page
  7.                         if ($thepage) $pagecontent = $thepage['body']; # get its content
  8.                         $this->SavePage($name, $pagecontent, $note); #create target page
  9.                                 }

There are 7 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki