Automatic Creation of Userpages on registration

Last edited by JavaWoman:
Modified links pointing to docs server
Mon, 28 Jan 2008 00:10 UTC [diff]

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.

The user is redirected to WelcomeUser after registration. If you don't want that, just delete the $this->Redirect(WelcomeUser); line after inserting the code.

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

                                // log in

                                $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

3. Todo and comments

- make the note for the creation a config-option (i love having everything configurable ;) --NilsLindenberg
- document
- test a little bit more
- offtopic: urgent note to myself: before registering ten times, should not forget to "comment-in" the code [don't ask ;)]

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