Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: liquid1002 - tammikuu 15, 2007, 07:31:47 IP

Otsikko: SMF sessions
Kirjoitti: liquid1002 - tammikuu 15, 2007, 07:31:47 IP
How Would I use the SMF session system to verify if someone is an Administrator / Mod and so on... I tried to find some topics in the forums but I had no luck.. Thanks in advance.


Edit: I've done some more researching and found how to use the session management... But I'm unable to view content, Even If I am in the $user_info['ID_GROUP']
Otsikko: Re: SMF sessions
Kirjoitti: JayBachatero - tammikuu 16, 2007, 09:00:50 AP
What code are you currently using?
Otsikko: Re: SMF sessions
Kirjoitti: liquid1002 - tammikuu 28, 2007, 06:13:45 AP
sorry, I've been gone for the past few weeks.  at the moment I am using


if($user_info['is_admin']){
    print "Welcome Back dewd!";
}else{
    print "Test Error Message";
}


But I wanted to use like  if($user_info['GROUP_ID'] = 1) type of thing
Otsikko: Re: SMF sessions
Kirjoitti: JayBachatero - tammikuu 28, 2007, 01:24:16 IP
if (in_array(ID_OF_GROUP, $user_info['groups']))
{
        echo 'Hello';
}
else
{
        echo 'bye';
}
Otsikko: Re: SMF sessions
Kirjoitti: liquid1002 - tammikuu 29, 2007, 10:47:25 AP
Now with the $user_info['groups'] am I able to set that to specific groups (ie: admin/mods)?

Thanks again for the help you are providing.

Edit
I've managed to get it to work for one group... But I need it for multiple groups
Otsikko: Re: SMF sessions
Kirjoitti: JayBachatero - tammikuu 29, 2007, 05:03:57 IP
I think this should help. How to use the SMF user system outside of SMF (http://docs.simplemachines.org/index.php?topic=789)
Otsikko: Re: SMF sessions
Kirjoitti: liquid1002 - tammikuu 29, 2007, 05:20:52 IP
That answers a lot of questions I would have had. Thanks for the link :)