DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:userhomepage

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
plugin:userhomepage [2017-04-01 02:14] – Date update (fix issue #30) Geekitudeplugin:userhomepage [2022-08-29 07:34] (current) – Added [userlink_icons] setting to choose image style Geekitude
Line 4: Line 4:
 description: Creates users' private namespace and/or public page and redirects them to their own private namespace on login. The pages are base on customizable templates. The current version added the public page feature, a helper and many ACL settings to cover common or uncommon usage. description: Creates users' private namespace and/or public page and redirects them to their own private namespace on login. The pages are base on customizable templates. The current version added the public page feature, a helper and many ACL settings to cover common or uncommon usage.
 author     : Simon Delage author     : Simon Delage
-email      : simon.geekitude@gmail.com +email      : sdelage@gmail.com 
-type       : Action +type       : Action  
-lastupdate : 2017-04-01 +lastupdate : 2022-08-29 
-compatible : Ponder Stibbons,Hrun,Detritus,Elenor Of Tsort+compatible : Ponder Stibbons,Hrun,Detritus,Elenor Of Tsort,Frusterick Manners,!Greebo, Hogfather, Igor
 depends    :  depends    : 
 conflicts  conflicts 
Line 20: Line 20:
 screenshot_img : http://www.geekitude.fr/externe/dokuwiki/userhomepage/screenshot.jpg screenshot_img : http://www.geekitude.fr/externe/dokuwiki/userhomepage/screenshot.jpg
 ---- ----
 +
 +:!: if you installed this plugin before 2021-12-16, note that instructions in [[plugin:userhomepage#user_links|User Links]] section changed a bit to keep original user check.
  
 ===== Installation ===== ===== Installation =====
  
-Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
-:!: **Important:** 2015-02-01's version introduced a crucial change in ACL process to reduce the amount of IO operations on //acl.auth.php// file and hopefully get rid of a bug that corrupted it from time to time. Please update ! :-)+:!: **Important:** 2015-02-01's version introduced a crucial change in ACL process to reduce the amount of IO operations on //acl.auth.php// file and hopefully get rid of a bug that corrupted it from time to time. Please update ! 
 + :-)
  
 ==== Upgrading from version 3.0.4 ==== ==== Upgrading from version 3.0.4 ====
Line 34: Line 37:
 A new option [Create Private Namespace] wich is disabled by default will prevent any page creation just after the installation of the new version. **Before enabling that option**, backup your ACL file (//conf/acl.auth.php//) A new option [Create Private Namespace] wich is disabled by default will prevent any page creation just after the installation of the new version. **Before enabling that option**, backup your ACL file (//conf/acl.auth.php//)
 and then remove ACL rules linked to the old version of the plugin.\\ and then remove ACL rules linked to the old version of the plugin.\\
-Note that the old template file is no longer bundled so it can't be overwritten by the new package ;-)+Note that the old page template file is no longer bundled so it can't be overwritten by the new package ;-)
  
 If you prefer to stick to old 3.0.4 version, [[https://github.com/geekitude/dokuwiki-plugin-userhomepage/archive/Fixed-Old-Version-3.0.4.zip|here's a package]] with only a few fixes to enable saving settings (wich didn't work in the most recent package available) and a minor change on ACL to actually protect the created user namespaces. If you prefer to stick to old 3.0.4 version, [[https://github.com/geekitude/dokuwiki-plugin-userhomepage/archive/Fixed-Old-Version-3.0.4.zip|here's a package]] with only a few fixes to enable saving settings (wich didn't work in the most recent package available) and a minor change on ACL to actually protect the created user namespaces.
Line 40: Line 43:
 ===== Settings ===== ===== Settings =====
  
-:!: **Warning** : some templates include an option for users' pages namespace wich default doesn't correspond to what's expected in a standard Dokuwiki install and that might be a source of conflict (for example ''wiki:user''). Make sure to have the same namespace in template's and User Homepage options.\\+:!: **Warning about Avatar plugin** : if local avatar images and UHP's private namespaces are stored in same place, UHP's ACL rules might block avatars for visitors. Consider changing either UHP's ['users_namespace'] or Avatar's ['namespace'] setting. 
 + 
 +:!: **Warning about templates** : some templates include an option for users' pages namespace wich default doesn't correspond to what's expected in a standard Dokuwiki install and that might be a source of conflict (for example ''wiki:user''). Make sure to have the same namespace in template's and User Homepage options.\\
 To my knowledge, concerned templates are [[doku>template:monobook|Monobook]] and [[doku>template:vector|Vector]] (please feel free to add any other). To my knowledge, concerned templates are [[doku>template:monobook|Monobook]] and [[doku>template:vector|Vector]] (please feel free to add any other).
  
Line 53: Line 58:
   * **groups_private** : list of groups concerned by private namespace creation (nothing will happen for users who don't belong to at least one of set groups) [default : empty (every users' groups are concerned)], added in **2015-11-26** version 8-)   * **groups_private** : list of groups concerned by private namespace creation (nothing will happen for users who don't belong to at least one of set groups) [default : empty (every users' groups are concerned)], added in **2015-11-26** version 8-)
   * **create_public_page** : enable creation of users' public pages [default: disabled (to make sure no public page is created before all settings are set the right way)]   * **create_public_page** : enable creation of users' public pages [default: disabled (to make sure no public page is created before all settings are set the right way)]
-  * **public_pages_ns** : namespace under wich users' public pages will be created (:!: __if you decide to change this setting__, you will have to manually manage interwiki user link used with ''showuseras'' setting((by creating a  //<dokuwiki_conf>/interwiki.local.conf// file to redirect that link to the correct namespace with something like <choosen_ns>      :<choosen_ns>:{NAME}))) [default : user]+  * **public_pages_ns** : namespace under wich users' public pages will be created (:!: __if you decide to change this setting__, you will have to manually manage interwiki user link used with ''showuseras'' setting((by creating a  //<dokuwiki_conf>/interwiki.local.conf// file to redirect that link to the correct namespace with something like <choosen_ns>      :<choosen_ns>:{NAME}))) [default : user] If you add '':%NAME%:%START%'' (and that precise string only) to get for example ''user:%NAME%:%START%'', a start page of a Public Namespace will be created instead of a single Public Page (//user:admin:start// for example), added in **2018-02-25** version 8-)((in that case, here is an example of what you should put //interwiki.local.conf// conf file for //user// interwiki link type: '':user:{NAME}:start'' (or adapt accordingly to your wiki's //start// setting)))
   * **acl_all_public** : ACL for @ALL group on others' public pages [default : read]   * **acl_all_public** : ACL for @ALL group on others' public pages [default : read]
   * **acl_user_public** : ACL for @user group on others' public pages [default : none]   * **acl_user_public** : ACL for @user group on others' public pages [default : none]
   * **groups_public** : list of groups concerned by public page creation (nothing will happen for users who don't belong to at least one of set groups) [default : empty (every users' groups are concerned)], added in **2015-11-26** version 8-)   * **groups_public** : list of groups concerned by public page creation (nothing will happen for users who don't belong to at least one of set groups) [default : empty (every users' groups are concerned)], added in **2015-11-26** version 8-)
-  * **templates_path** : :!:**since 2015-06-04 version**, this path should be relative to what is set by ['savedir'] option. As an exemple, if ['savedir'] is ''data'', a correct ['templates_path'] to point to ''.../data/pages/user'' would be ''./pages/user''. While a path inside ''<dokuwiki_data>/pages'' will make templates editable from within Dokuwiki, a path like ''lib/plugins/userhomepage'' will prevent any access to them (wich can be seen as an advantage, depending on your vision) and might be usefull to centralize them in a Dokuwiki farm setting. Old format values like "data/pages/..." still work but a notification will appear untill it is changed, sorry for the disturbance. +  * **templates_path** : :!:**since 2015-06-04 version**, this path should be relative to what is set by ['savedir'] option. As an exemple, if ['savedir'] is ''data'', a correct ['templates_path'] to point to ''.../data/pages/user'' would be ''./pages/user''. While a path inside ''<dokuwiki_data>/pages'' will make page templates editable from within Dokuwiki, a path like ''lib/plugins/userhomepage'' will prevent any access to them (wich can be seen as an advantage, depending on your vision) and might be usefull to centralize them in a Dokuwiki farm setting. Old format values like "data/pages/..." still work but a notification will appear untill it is changed, sorry for the disturbance. 
-  * **templatepath** : only kept for backward compatibility, this setting should point to the template used in previous version and wich will be used as new private template source **if it exists** (since the file isn't bundled anymore, **leaving this setting to it's default value with a fresh install of the plugin will do no harm and have no effect**). [default : ''lib/plugins/userhomepage/_template.txt'' or another path as set in previous version]+  * **templatepath** : only kept for backward compatibility, this setting should point to the page template used in previous version and wich will be used as new private page template source **if it exists** (since the file isn't bundled anymore, **leaving this setting to it's default value with a fresh install of the plugin will do no harm and have no effect**). [default : ''lib/plugins/userhomepage/_template.txt'' or another path as set in previous version]
   * **acl_all_templates** : ACL for @ALL group on plugin's templates if they are inside ''<dokuwiki_data>/pages'' [default : read]   * **acl_all_templates** : ACL for @ALL group on plugin's templates if they are inside ''<dokuwiki_data>/pages'' [default : read]
   * **acl_all_templates** : ACL for @user group on plugin's templates if they are inside ''<dokuwiki_data>/pages'' [default : read]   * **acl_all_templates** : ACL for @user group on plugin's templates if they are inside ''<dokuwiki_data>/pages'' [default : read]
-  * **no_acl** : absolutely no ACL rule will be automatically set (ACL options above will be ignored), including any protection on templates. Rules allready set will have to be manually removed. Only enable this option if you know what you're doing and have a specific need not covered by the options above. [default : disabled] +  * **no_acl** : absolutely no ACL rule will be automatically set (ACL options above will be ignored), including any protection on page templates. Rules allready set will have to be manually removed. Only enable this option if you know what you're doing and have a specific need not covered by the options above. [default : disabled] 
-  * **redirection** : enable or disable redirection (note that it will however occur on page creation). [default : enabled] //(added on 2015/08/20)//+  * **redirection** : enable or disable redirection (note that it will however occur on page creation but never occur when an action page is requested). [default : enabled] //(added on 2015/08/20)//
   * **action** : choose wich action is used on redirection to public page right after it's creation between 'do=edit' and 'do=show' (or private namespace start page). [default : edit]   * **action** : choose wich action is used on redirection to public page right after it's creation between 'do=edit' and 'do=show' (or private namespace start page). [default : edit]
   * **userlink_replace** : if ''showuseras'' global option is set to show interwiki link to user's page (only public page in most cases), this option enables the replacement of the template link by link(s) to either or both or user's public page and/or private namespace. This will only work with templates that trigger the ''COMMON_USER_LINK'' event, [[plugin:userhomepage#Templates and COMMON_USER_LINK event|see below]] (many thanks to [[https://github.com/Klap-in?tab=repositories|Klap-in]] for pointing that event ^_^) [default : enabled]   * **userlink_replace** : if ''showuseras'' global option is set to show interwiki link to user's page (only public page in most cases), this option enables the replacement of the template link by link(s) to either or both or user's public page and/or private namespace. This will only work with templates that trigger the ''COMMON_USER_LINK'' event, [[plugin:userhomepage#Templates and COMMON_USER_LINK event|see below]] (many thanks to [[https://github.com/Klap-in?tab=repositories|Klap-in]] for pointing that event ^_^) [default : enabled]
-  * **userlink_classes** : wich CSS classes will be applied to the replacement link(s). Note that if User Homepage's icons don't match the template's ones, adding ''iw_user'' might fix it. [default : ''interwiki wikilink1''].+  * **userlink_classes** : wich CSS classes will be applied to the replacement link(s). [default : ''interwiki iw_user'']. 
 +  * **userlink_icons** : choose between old school png or modern svg images for replacement link(s). [default : ''png''].
   * **userlink_fa** : if enabled, this option will switch from image icons to Fontawesome icons for the links sent with ''COMMON_USER_LINK'' event. :!: Fontawesome has to be installed with your template or a plugin. [default : ''disabled''].   * **userlink_fa** : if enabled, this option will switch from image icons to Fontawesome icons for the links sent with ''COMMON_USER_LINK'' event. :!: Fontawesome has to be installed with your template or a plugin. [default : ''disabled''].
  
-Right after saving settings, depending on selected options, you will get a success (or error m() message about the creation of the templates:\\+Right after saving settings, depending on selected options, you will get a success (or error m() message about the creation of the page templates:\\
 {{http://www.geekitude.fr/externe/dokuwiki/userhomepage/templates_successfull_copy.jpg}} {{http://www.geekitude.fr/externe/dokuwiki/userhomepage/templates_successfull_copy.jpg}}
  
 ===== Templates ===== ===== Templates =====
  
-The plugin uses two templates (''userhomepage_private.txt'' and ''userhomepage_public.txt'') that **will automatically be created when needed** (ie: enabling ''create_private_ns'' or ''create_public_page''in the path set in ''templates_path'' setting (from localized source files found in //<dokuwiki_plugins>/userhomepage/lang/<language_code>// folder). They contain basic informations usefull for users.+The plugin uses three page templates (''userhomepage_private.txt''''userhomepage_public.txt'' and eventually ''userhomepage_publicspace.txt'') that **will automatically be created when needed** (ie: enabling ''create_private_ns'' or ''create_public_page''to the path set in ''templates_path'' setting (from localized source files found in //<dokuwiki_plugins>/userhomepage/lang/<language_code>// folder). They contain basic informations usefull for users.
  
-:!: Don't edit the localized source files as they will be overwritten by plugin updates+:!: Don't edit the localized source files as they will be overwritten by plugin updates, only those within the path set in ''templates_path'' setting
  
-Templates can use any [[:namespace_templates|standard template replacement pattern]] (@NAME@, @USER@, ...) and the following specific ones:+Page templates can use any [[:namespace_templates|standard page template replacement pattern]] (@NAME@, @USER@, ...) and the following specific ones:
   * @TARGETPRIVATEPAGE@ : ID of user's private namespace start page   * @TARGETPRIVATEPAGE@ : ID of user's private namespace start page
   * @TARGETPRIVATENS@ : ID of user's private namespace   * @TARGETPRIVATENS@ : ID of user's private namespace
   * @TARGETPUBLICPAGE@ : ID of user's public page   * @TARGETPUBLICPAGE@ : ID of user's public page
   * @TARGETPUBLICNS@ : ID of the namespace containing all users' public pages   * @TARGETPUBLICNS@ : ID of the namespace containing all users' public pages
-Once the templates are set, here's what will happen when a user logs in:\\+Once the page templates are set, here's what will happen when a user logs in:\\
 {{http://www.geekitude.fr/externe/dokuwiki/userhomepage/first_login.jpg}} {{http://www.geekitude.fr/externe/dokuwiki/userhomepage/first_login.jpg}}
  
-==== Get more out of templates ====+==== Get more out of page templates ====
  
   * The [[plugin:include|Include]] plugin can be very usefull to include the wiki global start page in private namespace start page template so that the users, while redirected on login to their private page, will still have access to the global wiki start page...   * The [[plugin:include|Include]] plugin can be very usefull to include the wiki global start page in private namespace start page template so that the users, while redirected on login to their private page, will still have access to the global wiki start page...
-  * [[plugin:pagequery|Pagequery]] can also add some magic to User HomePage templates but be carefull because the requests can make the page quite slow to load :+  * [[plugin:pagequery|Pagequery]] can also add some magic to User HomePage page templates but be carefull because the requests can make the page quite slow to load :
     * ''<nowiki>{{pagequery>.*;filter=creator:@NAME@,!ns:user;sort=ns,title}}</nowiki>'' will show user's creations     * ''<nowiki>{{pagequery>.*;filter=creator:@NAME@,!ns:user;sort=ns,title}}</nowiki>'' will show user's creations
     * ''<nowiki>{{pagequery>.*;filter=contrib:@NAME@,!ns:user;sort=ns,title}}</nowiki>'' will show user's contributions     * ''<nowiki>{{pagequery>.*;filter=contrib:@NAME@,!ns:user;sort=ns,title}}</nowiki>'' will show user's contributions
  
-==== Private Namespace Skeleton ====+==== Private or Public Namespace Skeleton ====
  
-If tou create a folder named '//uhp_private_skeleton//' in same folder as 'Userhomepage' templates (so it should be '//.../data/pages/user/uhp_private_skeleton//' if you didn't change any option), and place page templates there, they will be added to user's private namespace on login (even is skeleton templates are added after user'private namespace creation).+If you create a folder named '//uhp_private_skeleton//' or '//uhp_public_skeleton//' in same folder as 'Userhomepage' page templates (so it should be '//.../data/pages/user/uhp_private_skeleton//' if you didn't change any option), and place page templates there, they will be added to user's private or public namespace(s) on login (even if skeleton page templates were added after user's namespace creation).
  
-  * You can add as many templates as you want in skeleton (even in sub folders if you wish) +  * You can add as many page templates as you want in skeleton (even in sub folders if you wish) 
-  * Skeleton templates can use same placeholders as regular 'Userhomepage' templates (see right above) +  * Skeleton page templates can use same placeholders as regular 'Userhomepage' page templates (see right above) 
-  * Skeleton templates files should be named as regular wiki pages (spaces must be replaced with underscores, don't use accentuated characters, use 'txt' file extension).+  * Skeleton page templates files should be named as regular wiki pages (spaces must be replaced with underscores, don't use accentuated characters, use 'txt' file extension).
  
 :!: This feature was added in 2015-10-04 version. :!: This feature was added in 2015-10-04 version.
 +:!: Skeleton feature was added for Public Namespace in 2018-02-27 version.
  
 ===== About ACL ===== ===== About ACL =====
Line 135: Line 142:
   * **getComplexLoggedInAs()** returns an <li> element like the "Logged in as" element of Dokuwiki template with a specific style and links to both private namespace and public page (if either doesn't exist, will default to relevant more simple link above or to standard string if neither exists) {{http://www.geekitude.fr/externe/dokuwiki/userhomepage/helper_complex_loggedinas.jpg}} //(added on 2014/09/19, improved on 2014/09/20, hopefully fixed on 2015/02/03 if neither page exist)//   * **getComplexLoggedInAs()** returns an <li> element like the "Logged in as" element of Dokuwiki template with a specific style and links to both private namespace and public page (if either doesn't exist, will default to relevant more simple link above or to standard string if neither exists) {{http://www.geekitude.fr/externe/dokuwiki/userhomepage/helper_complex_loggedinas.jpg}} //(added on 2014/09/19, improved on 2014/09/20, hopefully fixed on 2015/02/03 if neither page exist)//
   * **getAnyPublicLink("any user login")** returns an interwiki-like link (colored according to page existence) to provided user's public page (main purpose is to replace ''showuseras'' interwiki link in case public pages are not stored in '':user'' namespace) //(added on 2014/02/23)//   * **getAnyPublicLink("any user login")** returns an interwiki-like link (colored according to page existence) to provided user's public page (main purpose is to replace ''showuseras'' interwiki link in case public pages are not stored in '':user'' namespace) //(added on 2014/02/23)//
-  * **getElements()** returns an array containing id and localized string to build your own links to Private Namespace Start Page and/or Public Page //(added on 2015/08/20)//+  * **getElements()** returns an array containing id, strings and CSS classe(s) to build your own links to Private Namespace Start Page and/or Public Page //(added on 2015/08/20)//. Provide a true boolean parameter to include default classes based on plugin's related setting)
  
 ==== User links ==== ==== User links ====
Line 149: Line 156:
 </code> </code>
 ...with... ...with...
-<code php>if (!plugin_isdisabled('userhomepage')) { +<code php>                        if (!empty($_SERVER['REMOTE_USER'])) { 
-    $userhomepageHelper = plugin_load('helper','userhomepage'); +                            if ((!plugin_isdisabled('userhomepage')) and ($userhomepageHelper == null)) { 
-+                                $userhomepageHelper = plugin_load('helper','userhomepage'); 
-// If User HomePage helper is loaded, replace standard 'Logged in as...' link (case where one or both pages don't exist is managed by User HomePage helper +                            
-if ($userhomepageHelper) { +                            // If User HomePage helper is loaded, replace standard 'Logged in as...' link (case where one or both pages don't exist is managed by User HomePage helper) 
-    echo $userhomepageHelper->getComplexLoggedInAs(); +                            if ($userhomepageHelper) { 
-} else { +                                echo $userhomepageHelper->getComplexLoggedInAs(); 
-    echo '<li class="user">'; +                            } else { 
-    tpl_userinfo(); /* 'Logged in as ...' */ +                                echo '<li class="user">'; 
-    echo '</li>'; +                                tpl_userinfo(); /* 'Logged in as ...' */ 
-}+                                echo '</li>'; 
 +                            } 
 +                        } 
 +</code> 
 + 
 +==== Editor/locker link ==== 
 + 
 +Dokuwiki's ''showuseras'' setting is the best way to display a link to last editor's public page in ''docInfo'' section but if you prefer a link showing editor's login instead of full name, here is a way to do it. 
 + 
 +The file to change depends on template but with //Dokuwiki template//, it would be the file ''...lib/tpl/dokuwiki/main.php''. Open it and replace this line : 
 +<code php>                <div class="docInfo"><?php tpl_pageinfo() ?></div> 
 +</code> 
 +...with... 
 +<code php>                <div class="docInfo"> 
 +                    <?php 
 +                        // If Userhomepage helper is loaded 
 +                        if ($userhomepageHelper != null) { 
 +                            $userhomepageHelper->getPageInfo(); 
 +                        // Else if Userhomepage helper is not loaded yet but enabled 
 +                        } elseif (!plugin_isdisabled('userhomepage')) { 
 +                            $userhomepageHelper = plugin_load('helper','userhomepage'); 
 +                            $userhomepageHelper->getPageInfo(); 
 +                        // Otherwise use plain text 
 +                        } else { 
 +                            tpl_pageinfo(); 
 +                        } 
 +                    ?> 
 +                </div>
 </code> </code>
  
Line 211: Line 245:
  
 {{rss>https://github.com/geekitude/dokuwiki-plugin-userhomepage/commits/master.atom date 5}} {{rss>https://github.com/geekitude/dokuwiki-plugin-userhomepage/commits/master.atom date 5}}
 +
 +See [[https://github.com/geekitude/dokuwiki-plugin-userhomepage/commits/master|Github]] for older data
  
 ===== Known Bugs and Issues ===== ===== Known Bugs and Issues =====
plugin/userhomepage.1491005665.txt.gz · Last modified: 2017-04-01 02:14 by Geekitude

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