Current time: 05-23-2012, 09:57 PM Hello There, Guest! (LoginRegister)


Post Reply 
What's the best way to tell if user is logged in as ADMIN?
08-10-2011, 10:03 AM
Post: #1
What's the best way to tell if user is logged in as ADMIN?
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

MyBB = awesome
[Image: Lengua-fuera.png]
Find all posts by this user
Quote this message in a reply
08-10-2011, 10:06 AM
Post: #2
RE: What's the best way to tell if user is logged in as ADMIN?
PHP Code:
if($mybb->user['usergroup'] == 4) {
//do blah


-Nathan Malcolm
[Image: 1Zy5naW.gif] Quality Assurance Team

MyBB Security — MyBB Security & Support Forum
Visit this user's website Find all posts by this user
Quote this message in a reply
08-10-2011, 10:26 AM
Post: #3
RE: What's the best way to tell if user is logged in as ADMIN?
$mybb->usergroup['cancp']

Google SEO | Gravatar | Hooks | HTMLPurifier | Overview | Patches | PluginLibrary
Visit this user's website Find all posts by this user
Quote this message in a reply
08-10-2011, 10:59 PM
Post: #4
RE: What's the best way to tell if user is logged in as ADMIN?
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?

MyBB = awesome
[Image: Lengua-fuera.png]
Find all posts by this user
Quote this message in a reply
08-10-2011, 11:01 PM
Post: #5
RE: What's the best way to tell if user is logged in as ADMIN?
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

Google SEO | Gravatar | Hooks | HTMLPurifier | Overview | Patches | PluginLibrary
Visit this user's website Find all posts by this user
Quote this message in a reply
08-12-2011, 06:01 AM
Post: #6
RE: What's the best way to tell if user is logged in as ADMIN?
well, i might as well include global.php haha tnx much yo.. great help!

MyBB = awesome
[Image: Lengua-fuera.png]
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication