Revision [5068]

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

 

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

                                // log in
                                $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
                                }


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 ;)]


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