DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:homepages

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tips:homepages [2014-03-24 19:43] – [User links] Klap-intips:homepages [2020-05-12 17:11] (current) – add her because previous comment use her too gholk
Line 1: Line 1:
 ====== How to create user homepages ====== ====== How to create user homepages ======
  
-DokuWiki can be configured using user links to a user's personal wiki page. Additionally the ACL rights for these user pages can be set precisely to your wishes. +DokuWiki can be configured so that it links user's name to a user's personal wiki page. Additionally the ACL rights for these user pages can be set precisely to your wishes. 
  
 ==== User's name linking to homepages==== ==== User's name linking to homepages====
-[[devel:develonly]] 
  
 The [[config:showuseras]] config setting can be set to "User's full name as interwiki user link". Setting this option will display all the usernames in the wiki with a link to the ''user:<loginname>'' page.  The [[config:showuseras]] config setting can be set to "User's full name as interwiki user link". Setting this option will display all the usernames in the wiki with a link to the ''user:<loginname>'' page. 
Line 20: Line 19:
 # Additional lines for conf/acl.auth.php : # Additional lines for conf/acl.auth.php :
 # #
-# user can modify/delete his/her page+# user can modify/delete page in his/her namespace
 user:%USER%:         %USER%  AUTH_DELETE  user:%USER%:         %USER%  AUTH_DELETE 
 +# user can create/delete his/her own page
 +# (AUTH_EDIT is not enough, because page is not exist before)
 +user:%USER%            %USER%  AUTH_DELETE
 # all logged-in users can read the user pages # all logged-in users can read the user pages
 user:                @user   AUTH_READ user:                @user   AUTH_READ
Line 33: Line 35:
 See at [[:namespace templates]] how to create your namespace template. When you create a template for the default ''user:<loginname>'' pages, you want to create e.g. ''user:_template.txt'' via your filesystem.  See at [[:namespace templates]] how to create your namespace template. When you create a template for the default ''user:<loginname>'' pages, you want to create e.g. ''user:_template.txt'' via your filesystem. 
  
-**Tip:** When you like modify the namespace template via the browser, you need the plugin [[plugin:Templatepagename]]. This plugin let you configure via the [[plugin:config|Configuration manager]] a page name that is recognized as template page. Default ''c_template'', but of course you can choice your own name.+**Tip:** If you would like to modify the namespace template via the browser, you need the plugin [[plugin:Templatepagename]]. This plugin lets you configure via the [[plugin:config|Configuration manager]] a page name that is recognized as template page. Default ''c_template'', but of course you can choice your own name.
  
 =====See also===== =====See also=====
Line 41: Line 43:
   * [[:Namespace templates]] for prefilling content in new pages   * [[:Namespace templates]] for prefilling content in new pages
  
 +\\ \\ 
 +
 +===== How To: Autocreate homespace for users =====
 +
 +|:!: Please move this example into a plugin. |
 +
 +Use case: Because users are not able to create an own page in namespace "user:" in our wiki setup, we must provide them one. Best place to do this is when adding the user with the usermanager. The usermanager is a default plugin of DokuWiki and it's code is found at:
 +
 +  lib/plugins/usermanager/
 +
 +You can create the functionality by doing changes in ''[[xref>lib/plugins/usermanager/admin.php]]'':
 +
 +=== append new function ===
 +
 +<code php>
 +    /**
 +     * Create homedir (namespace) for user
 +     */
 +    function _createHomedir($user, $name){
 +    
 +        $userhome = dirname(wikiFN("home:$user:index"));
 +        $homebase = dirname($userhome);
 +        
 +        // create directory
 +        if(! @is_dir($userhome)) {
 +            io_makeFileDir($userhome.'/dummy.txt');
 +            msg("Homedir for user created", 1);
 +        }
 +
 +        // copy template from parent (modify this to fit YOUR needs !)
 +        $userpage = $userhome.'/index.txt';
 +        if(! @is_file($userpage)){
 +            $tpl = $homebase.'/template.txt';
 +            if(@is_file($tpl)) {
 +                $page = io_readFile($tpl);
 +                $page = preg_replace('/@USERNAME@/', $name, $page);
 +                io_saveFile($userpage, $page);
 +                msg("Template copied to homedir", 1);
 +            }
 +        }
 +    }
 +</code>
 +
 +=== change _modifyUser() ===
 +
 +<code php>
 +        if (empty($newuser)) return false;
 +
 +        # create homedir for new/existing user
 +        $this->_createHomedir($newuser,$newname);
 +
 +        $changes = array();
 +</code>
 +
 +=== change _addUser() ===
 +
 +<code php>
 +        if (empty($user)) return false;
 +
 +        # create homedir for new/existing user
 +        $this->_createHomedir($user,$name);
 +
 +        return $this->_auth->createUser($user,$pass,$name,$mail,$grps); 
 +</code>
 +
 +===General note===
 +Please read everything carefully and be aware that if you change the sourcecode of DokuWiki, that you need to update it every time DokuWiki is updated.
  
tips/homepages.1395686588.txt.gz · Last modified: 2014-03-24 19:43 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki