Can anyone help me with the basic code to test whether the logged-in user has admin privileges or not? I basically want to add a link to the admin panel within my home.htm and master.htm that only shows when I am logged in as an administrator. Thanks.
--
km
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- rgasch created topic »Using PageUtil::addVar() to load script code« 11:48 AM
- michiel responded to »password problem« 10:01 AM
- mazdev responded to »Hide "Register new account" and change template to 3 col« 07:50 AM
- mesteele101 created topic »Zikula 1.3.3 - Site Search 1.5.2 - Unable to turn off plug-ins« 07:48 AM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Code for testing admin
-
- Rank: Registered User
- Registered: Aug 24, 2010
- Last visit:
- Posts: 28
-
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1966
it depends which version of zikula you are using. here is the old (1.2.x) way:
Code
<!--[pnsecauthaction realm="0" comp="::" inst="::" level="ACCESS_ADMIN" assign="admin"]-->
<!--[if $admin eq true]-->
<li><a href="<!--[pnmodurl modname="Admin" func="adminpanel" type="admin"]-->"><img src='images/icons/small/configure.gif' alt='Administrate Site'></a></li>
<!--[/if]--> -
- Rank: Registered User
- Registered: Aug 24, 2010
- Last visit:
- Posts: 28
Dude, you rock. It worked like a charm.
If you are willing, could you give me a lesson on the first line? What is pnsecauthaction? And the other variables?
Where might I learn more about using this type of logic with zikula? It seems like it would have several applications.
--
km
- Moderated by:
- Support
Users on-line
- 0 users
This list is based on users active over the last 60 minutes.
