Jump to content

Admin area permissions array admin_perms


joedavis

Recommended Posts

Hello,

 

I am trying to create a template which will allow support staff to view the client summary page (and others) without necessarily viewing all of the content on the page. I would like to hide the Invoices/Billing area for example but not the other areas on the Client Summary page.

 

Within the menu I can check if the user in a role by using this bit of smarty:

{if in_array("View Orders",$admin_perms)}

 

But, that array isn't available to the clientsummary.tpl template for some reason. I created a hook for the AdminAreaPage hook to create my own admin permissions array and it works properly, except that the array isn't available on the clientsummary.tpl template.

 

Here's my hook:

add_hook("AdminAreaPage",1,"joeadminareahooks_permsarray");

function joeadminareahooks_permsarray($vars) {

$vars['_adminPerms'][] = $admin_perms;

return $vars;

}

 

What in the world do I need to do to get an array to be available on the clientsummary.tpl template? Am I missing something simple somewhere?

Edited by joedavis
trying to fix silly space in code that isn't really there but the editor wants it to be there
Link to comment
Share on other sites

That is the complete code. It's very simple.

 

The space isn't supposed to be there and it's not there in my code but for some reason when I pasted it, it shows with a space. I even went back and edited the post, completely removed that line and typed it by hand and the space is still there. I figured there was something screwy in the editor.

Link to comment
Share on other sites

  • 1 month later...

Dudes, no need to get grumpy...it's quite simple

 

Here you go, try this:

 

function joeadminareahooks_permsarray() {
 $command = "getadmindetails";
 $results = localAPI($command);

 if(strpos($results['allowedpermissions'], "View Orders"))
   echo "Whatever...";
}
add_hook("AdminAreaClientSummaryPage",1,"joeadminareahooks_permsarray");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated