Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Working out if someone is an "admin" ?

Quote Reply
Working out if someone is an "admin" ?
Hi,

Ok, I have a feeling there is gonna be a really easy solution for this - but I can't work it out :(

At the moment, I need to work out if a user is "admin" - to give them access to a certain function. Now, I'm already doing stuff via the "action", so only members/mods/admins can view the functions I'm working on - but doing:

Code:
print $IN->header;
use Data::Dumper;
print Dumper($USER);

..doesn't really give me the info I need.

Furthermore, I'm looking in the UserGroups table - and I can't see any obviouse way to determine if a username is classed as "admin" (only seems there are groups for Guest/Registered/Moderators).

Am I missing something really stupid? (been a long day, so wouldn't suprise me :P)

TIA

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Working out if someone is an "admin" ? In reply to
Try this:

<%if current_user_id and current_user_status >= 3%>
...
<%endif%>
Quote Reply
Re: [gotze] Working out if someone is an "admin" ? In reply to
Hi,

Thanks for the reply. The problem is, thats just a template solution - and I need something I can use in a plugin :(

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Working out if someone is an "admin" ? In reply to
Last time I looked the permissions are constants in GForum.pm so you'd need to import them and do something like:

if ($USER == USER_STATUS_ADMIN)

....or whatever the right name is.
Quote Reply
Re: [Wychwood] Working out if someone is an "admin" ? In reply to
Thanks, will check that out :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Wychwood] Working out if someone is an "admin" ? In reply to
If you're checking the current user, then use:

Code:
use GForum qw/:user/;
if ($USER->{user_status} == ADMINISTRATOR) {

Adrian

Last edited by:

brewt: Dec 8, 2008, 11:28 AM
Quote Reply
Re: [brewt] Working out if someone is an "admin" ? In reply to
Hi,

Thanks, thats perfect :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Working out if someone is an "admin" ? In reply to
andy what is this for?

I'm looking for a way to assign to some moderators to add other users to special groups.
Quote Reply
Re: [carminejg3] Working out if someone is an "admin" ? In reply to
Sorry?

This was just for using in a plugin, to work out if the current user is an administrator =)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates