PDA

View Full Version : VBOptions in array


TheInsaneManiac
02-03-2009, 07:07 PM
<if condition="in_array($bbuserinfo[userid], array($vbulletin->options['appsaccess']))">

When I go into my settings and type 498,3 then only user 498 will see the content, but user 3 won't. Why is this?

Lynne
02-03-2009, 11:18 PM
I ran into the same thing on a mod I wrote a while ago. I had to do this (mine was for forumids, so change your condition appropriately).

In a plugin:
$vfarray=$vbulletin->options[verify_forums];
$verifyforums = explode(",", $vfarray);

In the template:
<if condition=" in_array($threadinfo[forumid], $verifyforums)">

TheInsaneManiac
02-04-2009, 01:21 AM
So I would have to make it a global plugin right?

Lynne
02-04-2009, 03:00 AM
It depends on where you need whatever it is you are doing. If you only need it on one page, then I wouldn't use a plugin that is used on every page.

Dismounted
02-04-2009, 04:54 AM
As you are already using a plugin, you may want move all your logic into your plugin as well (and just check if a variable is true or false inside the template).

TheInsaneManiac
02-04-2009, 05:58 PM
As you are already using a plugin, you may want move all your logic into your plugin as well (and just check if a variable is true or false inside the template).
How can I go about that? Cause I don't want to add any extra queries, I just need this to run on my staff application area.

Lynne
02-04-2009, 08:12 PM
How can I go about that? Cause I don't want to add any extra queries, I just need this to run on my staff application area.

You'd do something like this:

$vfarray=$vbulletin->options[appsaccess];
$appsaccess = explode(",", $vfarray);
if (in_array($vbulletin->userinfo['userid'], $appsaccess)) $userinarray = true;Then in your template:

<if condition="$userarray == true">
do something
</if>

(not tested)