|
Cookbook /
DynamicPageActionsSummary: Dynamic PageActions
Version: 1.1
Status:
Maintainer: hartwork
Discussion: DynamicPageActions-Talk
Categories: Content Management System Add-Ons
Questions answered by this recipeHow can I show/hide certain page actions for logged-out users? DescriptionThis recipe provides a Site.PageActions page that adapts itself
according to the current login status and page action.
InstallationThese files have to be modified:
config.phpAdd these lines to you local/config.php: # Provide action conditional (:if action ACTION:)
$Conditions['action'] = '\$GLOBALS["action"]==\$condparm';
# Viewing the diff also requires "edit" rights
# which logged-out users usually don't have.
# Thanks for this to Hagan Fox.
$HandleAuth['diff'] = 'edit';
Site.PageActionsThis recipe works with AuthUser or UserAuth. Variant for AuthUserChange your Site.PageActions to: * [[{$FullName}?action=search | $[Search] ]]
(:if ( ! action browse ) :)
* %item class=browse accesskey='$[ak_view]'%[[{$FullName} | $[View] ]]
(:if ( auth edit && ! action edit ) :)
* %item rel=nofollow class=edit accesskey='$[ak_edit]'%[[{$FullName}?action=edit | $[Edit] ]]
(:if ( auth edit && ! action diff ) :)
* %item rel=nofollow class=diff accesskey='$[ak_history]'%[[{$FullName}?action=diff | $[History] ]]
(:if ( auth upload ) :)
* %item rel=nofollow class=upload accesskey='$[ak_attach]'%[[{$FullName}?action=upload | $[Attach] ]]
(:if ( ! action print ) :)
* %item rel=nofollow class=print accesskey='$[ak_print]'%[[{$FullName}?action=print | $[Print] ]]
(:if ( authid ) :)
* %item rel=nofollow class=logout accesskey='$[ak_login]'%[[{$FullName}?action=logout | $[Logout] ]]
(:if ( ! authid ):)
* %item rel=nofollow class=login accesskey='$[ak_logout]'%[[{$FullName}?action=login | $[Login] ]]
(:if:)
Variant for UserAuthChange your Site.PageActions to: * [[{$FullName}?action=search | $[Search] ]]
(:if ( ! action browse ) :)
* %item class=browse accesskey='$[ak_view]'%[[{$FullName} | $[View] ]]
(:if ( loggedin && ! action edit ) :)
* %item rel=nofollow class=edit accesskey='$[ak_edit]'%[[{$FullName}?action=edit | $[Edit] ]]
(:if ( loggedin && ! action diff ) :)
* %item rel=nofollow class=diff accesskey='$[ak_history]'%[[{$FullName}?action=diff | $[History] ]]
(:if ( loggedin && auth upload ) :)
* %item rel=nofollow class=upload accesskey='$[ak_attach]'%[[{$FullName}?action=upload | $[Attach] ]]
(:if ( ! action print ) :)
* %item rel=nofollow class=print accesskey='$[ak_print]'%[[{$FullName}?action=print | $[Print] ]]
(:if ( loggedin ) :)
* %item rel=nofollow class=logout accesskey='$[ak_login]'%[[{$FullName}?action=logout | $[Logout] ]]
(:if ( ! loggedin ) :)
* %item rel=nofollow class=login accesskey='$[ak_logout]'%[[{$FullName}?action=login | $[Login] ]]
(:if:)
NotesTested with PmWiki 2.1.2 Release Notes
See AlsoAuthUser ContributorsCommentsSee discussion at DynamicPageActions-Talk User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |