tips:homepages
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tips:homepages [2014-03-24 19:43] – [User links] Klap-in | tips: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 | + | DokuWiki can be configured |
==== User's name linking to homepages==== | ==== User's name linking to homepages==== | ||
- | [[devel: | ||
The [[config: | The [[config: | ||
Line 20: | Line 19: | ||
# Additional lines for conf/ | # Additional lines for conf/ | ||
# | # | ||
- | # user can modify/ | + | # user can modify/ |
user: | user: | ||
+ | # user can create/ | ||
+ | # (AUTH_EDIT is not enough, because page is not exist before) | ||
+ | user: | ||
# all logged-in users can read the user pages | # all logged-in users can read the user pages | ||
user: | user: | ||
Line 33: | Line 35: | ||
See at [[: | See at [[: | ||
- | **Tip: | + | **Tip: |
=====See also===== | =====See also===== | ||
Line 41: | Line 43: | ||
* [[: | * [[: | ||
+ | \\ \\ | ||
+ | |||
+ | ===== 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 " | ||
+ | |||
+ | lib/ | ||
+ | |||
+ | You can create the functionality by doing changes in '' | ||
+ | |||
+ | === append new function === | ||
+ | |||
+ | <code php> | ||
+ | /** | ||
+ | * Create homedir (namespace) for user | ||
+ | */ | ||
+ | function _createHomedir($user, | ||
+ | | ||
+ | $userhome = dirname(wikiFN(" | ||
+ | $homebase = dirname($userhome); | ||
+ | | ||
+ | // create directory | ||
+ | if(! @is_dir($userhome)) { | ||
+ | io_makeFileDir($userhome.'/ | ||
+ | msg(" | ||
+ | } | ||
+ | |||
+ | // copy template from parent (modify this to fit YOUR needs !) | ||
+ | $userpage = $userhome.'/ | ||
+ | if(! @is_file($userpage)){ | ||
+ | $tpl = $homebase.'/ | ||
+ | if(@is_file($tpl)) { | ||
+ | $page = io_readFile($tpl); | ||
+ | $page = preg_replace('/ | ||
+ | io_saveFile($userpage, | ||
+ | msg(" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | === change _modifyUser() === | ||
+ | |||
+ | <code php> | ||
+ | if (empty($newuser)) return false; | ||
+ | |||
+ | # create homedir for new/ | ||
+ | $this-> | ||
+ | |||
+ | $changes = array(); | ||
+ | </ | ||
+ | |||
+ | === change _addUser() === | ||
+ | |||
+ | <code php> | ||
+ | if (empty($user)) return false; | ||
+ | |||
+ | # create homedir for new/ | ||
+ | $this-> | ||
+ | |||
+ | return $this-> | ||
+ | </ | ||
+ | |||
+ | ===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