PDA

View Full Version : What is wrong with this code?


Christine
04-17-2004, 09:07 PM
I am trying to set up subscriptions, and need to block style selections for free members. I can't do an is IN (x,y) in the modifyoptions and footer templates as it gives me an error saying that IN isn't one of the options I can use for conditional functions.

I tried this in phpinclude_start, but it isn't working either: if ($bbuserinfo['membergroupids'] IN (20,21))
}
$vboptions['allowchangestyles'] = 1;
} else {
$vboptions['allowchangestyles'] = 0;
}I know I am missing something simple here, but I don't know what.

Can anyone help?

assassingod
04-17-2004, 09:11 PM
The second line is } instead of {

TouchingVirus
04-17-2004, 09:22 PM
Why not try this..


if (($bbuserinfo['membergroupids']=='20') || ($bbuserinfo['membergroupids']=='21'))
}
$vboptions['allowchangestyles'] = 1;
} else {
$vboptions['allowchangestyles'] = 0;
}

or if that fails (it might or mightn't work..i never used that varaible..)..this should work

if (($bbuserinfo[usergroupid]=='20') || ($bbuserinfo[usergroupid]=='21'))
}
$vboptions['allowchangestyles'] = 1;
} else {
$vboptions['allowchangestyles'] = 0;
}

TouchingVirus
04-17-2004, 09:24 PM
And what assassingod said is true too ..i forgot to post that in my message :P..but it that was the actual code, it should give a PARSE error somewhere along the line...

Boofo
04-17-2004, 09:58 PM
if (in_array($bbuserinfo['membergroupids'], array(20,21)))
{
$vboptions['allowchangestyles'] = 1;
}
else
{
$vboptions['allowchangestyles'] = 0;
}

Christine
04-17-2004, 10:40 PM
Very odd -- I wonder why it didn't give me any parse errors? It just seemed to ignore that section of the code all together.

Let me try to fix it...

Boofo
04-17-2004, 11:29 PM
Why don't you use the is_member_of condition? ;)

Christine
04-18-2004, 12:04 AM
It is fixed -- thanks!

Bob -- I am not familiar with that, is it a better way?

I am still confuzzled as to why I didn't get a parse error with that { in there wrong. Oh well.

Boofo
04-18-2004, 12:49 AM
What code did you end up using?

TouchingVirus
04-18-2004, 01:08 PM
Indeed, say who won :P:P

Christine
04-18-2004, 06:37 PM
Since I am trying to learn how to work with arrays, I kept Bob's, but all three methods worked.

:D

TouchingVirus
04-18-2004, 07:05 PM
* TouchingVirus pays Boofo

damnit, i will get you again :D

Boofo
04-18-2004, 09:01 PM
* TouchingVirus pays Boofo


damnit, i will get you again :D

And no checks! Cash only! ;)