Fork me on GitHub

Admin switch in theme  Bottom

  • I have looked through the forums, but couldn't find this info.... What I need is a general Admin switch for dynamic menus on my site, so that I can say "if admin (show admin panel link;show admin only forum link;show pnphpbb2 admin panel link)". Better yet, is there a listing of useful availble variables? TIA!
  • Research permissions. You can do that through permession rules.
  • No, what I'm doing is setting up a DHTML menu, that's dynamically created. I want the admin menu options to only appear for admins, but the menu in general will be there for everyone. A simple if statement, but I don't know what the variable name to test.
  • you need to check against the various module components. check /includes/blocks/menu.php (waiting content area) for the basic idea.

    --
    regards from germany
    ..::[Zikula Application Framework]::.. ..::[SEO-Blog]::.. ..::[CMS Sicherheit]::..
  • Thanks, lars! There's not an ACCESS_ADMIN in there, but it gave me enough to find "'Permissions::', '::', ACCESS_ADMIN". If you can change permissions, you're an Admin, and it very nicely uses Pyro's suggestion icon_wink

    IMHO, there should be a global admin that is defined through a single variable check, instead of through a function (most sites only have one admin anyways)... Same thing with user logged in (phpBB uses $userdata["user_level"] and ["session_logged_in"])

    For anyone else stumbling on this post, this should work (I have not tested yet)

    Code

    if (!pnSecAuthAction(0, 'Permissions::', '::', ACCESS_ADMIN)) {
    (some code)
    }


    Curious what the 0 indicates...?
  • Easy with Autotheme:

    Code

    if (atIsAdminUser()) {
    //code here
    }


    Regards

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment

This list is based on users active over the last 60 minutes.