News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

$context['user']['is_mod'] always empty

Started by fozzy, August 23, 2010, 07:53:06 AM

Previous topic - Next topic

fozzy

Hello all,
i tried searching but i can't find an answer even if it looks like a couple of similar posts were made in the past.

i can't get $context['user']['is_mod'] to work as expected.
If the user is moderator or global_moderator doesnìt change, the variable is always empty.

Is this possibly a bug or am i doing something wrong?

running 2.0RC3, is_admin and is_guest work as expected.

Thanks, Luca


fozzy

i tried that and got always 1 even for a normal user, just tried again and it looks like i didn't get my test user out of some mod group...

Thanks, will use that one. :)

PS: Would still be interesting to know what the diff between is_mod and can_mod should be. THanks.

Kindred

a user if only set to be a mod (is_mod) when that user is present IN the board which they mod. Global moderators, regardless of the title are not actually moderators per the code
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Acans

What exactly are you trying to do?

Are you trying to add a menu that only gmod can see, or something else, ect.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

fozzy

Quote from: Kindred on August 23, 2010, 10:39:12 PM
a user if only set to be a mod (is_mod) when that user is present IN the board which they mod. Global moderators, regardless of the title are not actually moderators per the code

That explains it.
I'm running SSI.php on an external page and wanted some code sections to appear to mods only.
I can live with can_mod, mostly curious about why is_mod "didn't work (as expected by me)".

Thanks a lot. :)

Kindred

I would suggest creating a "moderators access" membergroup then. The group will be global (as opposed to the moderator flag) and you can then perform functions looking to see if a member belongs to that group#
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

fozzy

i'll have a look at it.. but that would require a couple extra checks while i now have the $context available, let's first see if my website will be used or not :-)

Thanks.

Advertisement: