Need help with nav link and 2 membergroups

Started by Mick., January 08, 2011, 08:01:07 PM

Previous topic - Next topic

Mick.

Hey y'all,

Im trying to make a link in my menu only visible to admin, global moderator and another membergroup i created but frankly, i dont know how.

So far i have this:

                                echo '
                                        <li><a href="http://www.chevyavalancheclub.com/index.php/page,497.html">' , $txt['editors_blog'] , '</a></li>';


For admins, i think i can add something like this:
if ($context['allow_admin'])

but what about the other 2 membergroups?

admin--->group 1
g moderator--->group 2
other group--->group 35


Im using SMF RC3  ;)


Thanx,
Mick

Arantor

if (in_array($GLOBALS['user_info']['groups'], array(1,2,35))
{
echo '.....';
}

* IncognitoMuse is too lazy to get into using global $user_info, when you can do that...
Holder of controversial views, all of which my own.


Mick.

I got a Parse error: syntax error, unexpected T_GLOBAL, expecting T_VARIABLE or '$' in /home


I added:

global $user_info

like this:
global $context, $settings, $options, $scripturl, $txt, global $user_info;

and added the button but got the error..  :-\

                                        if (in_array($GLOBALS['user_info']['groups'], array(1,2,35))
{
                                        echo '
<li><a href="http://www.chevyavalancheclub.com/index.php/page,497.html"><img align="absMiddle"
src="http://www.chevyavalancheclub.com/images/menu_icons/bullet_go.png" />&nbsp;' , $txt['editors_blog'] , '</a></li>';
}




Arantor

The whole point of using $GLOBALS was so that you didn't have to add it to the global list...

Actually, I realised that I screwed up through not feeling 100% this evening.

Try:
$var = array_intersect($GLOBALS['user_info']['groups'], array(1,2,35));
if (count($var) != 0)


* IncognitoMuse hasn't tested this though.
Holder of controversial views, all of which my own.


Mick.

Thank you sir, you always to the rescue!  That worked.


Get better, ya hear? ;)

Advertisement: