The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
syntax problems with checking for constants in an array?
if ($user[membergroupids] == USERGROUP_A) always returns true, but
if ($user[membergroupids] == 'USERGROUP_A') and if ($user[membergroupids] == " . USERGROUP_A . ") always returns false If I just go if ($user[membergroupids] == '2'), it works as it should. Similarly, later on, if ($groupid != USERGROUP_A) branches properly. WTF am I doing wrong? |
#2
|
||||
|
||||
Have you tried $user['membergroupids'] ?
|
#3
|
|||
|
|||
That doesn't seem to affect it.
Thanks, though. |
#4
|
||||
|
||||
$user[membergroupids] is a list of user groups separated by commas
you need to explode(',') it and get an array with a list of user group ids to work with not sure if constants get parsed inside quotes, but this if ($user[membergroupids] == " . USERGROUP_A . ") should work I think O_o |
#5
|
|||
|
|||
Correct. I was actually trying to check for one (and only one) membergroup. If there were more than one, it branched and did something else.
That always returns as false. I'm not sure why. |
#6
|
||||
|
||||
Code:
if ($user[membergroupids] == " . USERGROUP_A . ") |
#7
|
||||
|
||||
still he's curious, as am I
|
#8
|
||||
|
||||
PHP Code:
|
#9
|
||||
|
||||
Are you referring to my post? If you are, you're not starting the string, so it'd error out.
Code:
if ($user[membergroupids] == "" . USERGROUP_A . "") |
#10
|
||||
|
||||
Why even add the empty strings around it though?
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|