We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Error in my plugin when not logged in as admin

Development and Programming

trevororr's avatar
trevororr
2 posts
12 years ago
trevororr's avatar trevororr

I am writing a plugin that checks if you are logged in as a super admin for use in a template and returns 0 or 1. If you are logged in as a super admin it works fine, it not the web page is blank, so kind of error in my code I am assuming but I can not figure out what the problem is.

Here is my template code

{if {exp:admin:isadmin} == 1}
 do something here 
{/if}

Here is my php code

public function isadmin()
{
 return $this->EE->session->userdata('group_id') == "1";
}

Any ideas? Any way to trap the error? I tried putting a try / catch in the function and return 0 but that did not make any difference. Is there a better way to check if logged in as super admin?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.