MyBB Community Forums

Full Version: How to make a link Admin Only
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey there MyBB, first up, sorry if I've put this topic in the wrong forum!

Now, my question is:

Using a php code, can I make a link Admin only?
I mean this with Site Integration, I want Admins/Super Mods to only see certain links.

I have a code which hides things from guests, which is:
<?php

if($mybb->user['uid'])
{
echo "HEY THERE MEMBER";
}
else
{
echo "ACCESS DENIED GUESS";
}
?>

Is there any way this can be edited for Team Members only?

Thanks a bunch! Big Grin
To make it admin only:

if($mybb->usergroup['cancp'])
{
     // User is an admin
}

For a super moderator:

if($mybb->usergroup['issupermod'])
{
     // User is a Super Moderator
}

Is just a moderator:

if($mybb->usergroup['canmodcp'])
{
     // User is a moderator
}

Smile
So, for example:

<?php

if($mybb->usergroup['cancp'])
{
     // Admin Links Etc.
}
else
{
echo "ACCESS DENIED EVERYONE ELSE";
}
?>

correct? Smile
Correct - that should work Smile

Or

if($mybb->usergroup['cancp'] || $mybb->usergroup['issupermod'])
{
     // User is an Admin or Super Mod
}
else
{
     error_no_permission(); // Nice MyBB "No Permissions" error
}
AWESOME Big Grin

thanks for that Tomm!
nice, should be move on Submitted Tutorial Smile