Log in

View Full Version : multiple id's for if condition="$bbuserinfo


TheRayden
04-08-2005, 07:52 PM
I have set a conditional for a private menu section on my vbadvanced site using this code:

<if condition="$bbuserinfo[usergroupid]==6">

Now, I wish to add multiple usergroups here but whatever method I try results in an error.

So if I try 6,14 I get this error:

The following error occurred when attempting to evaluate this template:

Parse error: parse error, unexpected ',' in /home/archimed/public_html/redpill/includes/adminfunctions_template.php(3096) : eval()'d code on line 8

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.

The same goes for ; or : or a space, etc etc

I'm obviously missing something small here, but I can't seem to find it.

amykhar
04-08-2005, 07:56 PM
There is a hack that will let you use a list of usergroups. It takes a minute to install and is a joy to have.

https://vborg.vbsupport.ru/showthread.php?t=61149&highlight=is_member_of

Zachery
04-08-2005, 07:59 PM
You can always make use of arrays :) and in_array

amykhar
04-08-2005, 08:04 PM
You can always make use of arrays :) and in_array
even in templates?

TheRayden
04-08-2005, 08:09 PM
There is a hack that will let you use a list of usergroups. It takes a minute to install and is a joy to have.

https://vborg.vbsupport.ru/showthread.php?t=61149&highlight=is_member_of

Worked like a charm. Thank you. ;)

Zachery
04-08-2005, 08:19 PM
even in templates?
<if condition="in_array($bbuserinfo[usergroupid], array(X,Y,Z))"> test </if>

works fine :)

amykhar
04-08-2005, 11:05 PM
<if condition="in_array($bbuserinfo[usergroupid], array(X,Y,Z))"> test </if>

works fine :)
Cool. Learn something new every day. The thing about my suggestion though is that it gets member groups and not just primary groups.