Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: bneacetp - maaliskuu 19, 2006, 03:30:09 IP

Otsikko: Problem With $user_info in My index.template.php File
Kirjoitti: bneacetp - maaliskuu 19, 2006, 03:30:09 IP
I am trying to use the code below to check to see if the visitor is a member of a certain member group.  If the user is, I want some HTML to be echo'ed out.  For some reason, it seems as though the condition below fails.  I am a member of the member group that is being checked for so that can't be it.  Anyway, here is the basic code that I am trying to get to work.

if(in_array(20, $user_info['groups']))
{
      echo '[...]';
}


Anyone have any suggestions that might resolve this issue?  Thanks in advance. 

*edit* by the way, I am using SMF 1.1 RC2.
Otsikko: Re: Problem With $user_info in My index.template.php File
Kirjoitti: Thantos - maaliskuu 19, 2006, 03:37:55 IP
make sure $user_info is in the list of global variables.  So at the beginning of the function you should see something like:

global $context, $txt, $settings;

If $user_info isn't in that list just add it in.
Otsikko: Re: Problem With $user_info in My index.template.php File
Kirjoitti: bneacetp - maaliskuu 19, 2006, 05:44:23 IP
Thanks.  That did it.  :)