View Full Version : Need IsAdmin function
Greebo
03-28-2005, 11:32 AM
I need an IsAdmin function that works like the CanModerate function but only returns a true flag if the user is a member of the Administrator group.
Can anyone please help?
Deaths
03-28-2005, 11:47 AM
Do you want this for templates, or for files?
You can just use this:
if (($permissions['adminpermissions'] & CANCONTROLPANEL))
{
//your code
}
That way, everyone who has access to the ACP can view the code between the if tags.
Greebo
03-28-2005, 11:50 AM
That works! thanks!
Deaths
03-28-2005, 11:53 AM
No problem ;)
Bolas
03-28-2005, 11:54 AM
// if the admin groupid is 6 (as default)
$isAdmin = is_member_of(6); // boolean
I hope this will answer to you.
--------------------------------
PS:
Also you can use it in templates:
<if condition="is_member_of(6)">
<p>you are an admin.</p>
</if>
Revan
03-28-2005, 01:46 PM
or, you can include('./includes/adminfunctions.php'); then do if (can_administer())
Colin F
03-29-2005, 09:00 AM
is_member_of() needs the $bbuserinfo passed over to it as well though:
if (is_member_of($bbuserinfo, 6))
{}
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.