Retrieving User Group ID

Started by shockuk, September 23, 2009, 05:15:32 AM

Previous topic - Next topic

shockuk

Hi all,

Just a quick question -

Currently developing a (my first) mod for SMF. I retrieve the currently logged on user's name using $context['user']['name']

Does anyone know how I would retrieve the ID of which group this user is in?

Thanks very much,
Shockuk.

Arantor

Primary group or secondary groups?


Arantor

$context['user']['groups'] should be an array holding them all, $context['user']['groups'][0] should be their primary group.

shockuk

Ah doesn't seem to work matey (there's nothing set in that array).

Maybe I should've mentioned that i'm calling SMF from another script using SSI.php

Arantor

I thought it moved it into $context (which it does in other situations)

$user_info['groups'] instead then.

shockuk

Works like a charm!

Thanks very much :)

Arantor

Good to know that sorted it. I'll mark this one solved for now.

Advertisement: