MyBB Community Forums
What's the best way to tell if user is logged in as ADMIN? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: What's the best way to tell if user is logged in as ADMIN? (/thread-101334.html)



What's the best way to tell if user is logged in as ADMIN? - brownchild - 2011-08-10

What's the best way to tell if user is logged in as ADMIN?

i need it for my manual code and site integration

Tanks


RE: What's the best way to tell if user is logged in as ADMIN? - Nathan Malcolm - 2011-08-10

if($mybb->user['usergroup'] == 4) {
//do blah
}



RE: What's the best way to tell if user is logged in as ADMIN? - frostschutz - 2011-08-10

$mybb->usergroup['cancp']


RE: What's the best way to tell if user is logged in as ADMIN? - brownchild - 2011-08-10

thanks to both of you,

ok so one more thing, how do i get this variable into my script? i checked out the cookie created but i see no variable set that indicates usergroup or even userid..

i do see sid <-- w/c seems to be a session id? is it? and is this the only way to get the usergroup data by via sid instead of uid?


RE: What's the best way to tell if user is logged in as ADMIN? - frostschutz - 2011-08-10

You get it when you include MyBB's global.php. If you want to be independent, you'll have to look at the cookie first and then talk to the database to verify that the cookies are indeed correct. Basically what MyBB does in it's init / session


RE: What's the best way to tell if user is logged in as ADMIN? - brownchild - 2011-08-12

well, i might as well include global.php haha tnx much yo.. great help!