News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

$context['user']['is_admin']

Started by Fabius85, December 15, 2009, 05:13:49 AM

Previous topic - Next topic

Fabius85

i wanted to show a link (into the statistics box) if only a user is admin, so i put a code like this into BoardIndex.template.php
if ($context['user']['is_admin']=1)
{
    echo '<a href="www.mylinkhereonlyforadmins.com">[ MyLinkHereOnlyForAdmins ]</a>';
}

but the link is displayed to everyone!
so i tried using $user_info['is_admin'] instead of $context['user']['is_admin'] however with the same result.
i tried printing $context['user']['is_admin'] value, and i noticed that it is set to 1 for EVERYONE, even if guest or not admins!
is that normal or am i doing something wrong?

ps: just noticed that even $context['user']['id'] returns always 1 instead of the real UserID....

Fabius85

no matter, just fixed it, i was using =1 instead of ==1 ^^

Arantor

You don't even have to do that, simply if($context['user']['is_admin']) will work.

Matthew K.

Marking this topic as resolved, feel free to un-resolve it if you have any further problems with this.

Labradoodle-360

Advertisement: