View Full Version : explode usergroup
FreshFroot
09-26-2008, 08:08 AM
I've done this before it and worked fine for another plugin.
However, I'm having issues, here is my code.
global $vbulletin;
$ugs = explode(',',$vbulletin->options['nr_fid'])
if ( in_array(THIS_SCRIPT, array('forumdisplay', 'showthread'))
&& !in_array( $forumid, array($ugs) ) )
now in the array($ugs), if I put the forum id manually 5,6,7, it works fine. For some reason it doesn't work with the explode command? anyone have any tips around it?
Dismounted
09-26-2008, 09:07 AM
Why are you creating an array of $ugs, when it is already an array? ;)
FreshFroot
09-26-2008, 10:15 PM
well I took out $ugs and put in this:
global $vbulletin;
if ( in_array(THIS_SCRIPT, array('forumdisplay', 'showthread'))
&& !in_array( $forumid, array($vbulletin->options['nr_fid']) ) )
The problem is in the ACP the user can enter the forumid so: 6,5
The 6 works fine, but it seems like the comma and 5 etc.. don't work.
Am I missing something here?
Guest190829
09-26-2008, 10:22 PM
I think means with this bit:
array($ugs)
In your first post...it's not necessary - as $ugs is already an array.
FreshFroot
09-26-2008, 11:10 PM
If I place this code.. it works fine.
global $vbulletin;
if ( in_array(THIS_SCRIPT, array('forumdisplay', 'showthread'))
&& !in_array( $forumid, array(5, 6) ) )
now I want the values of 5,6 etc.. etc.. from $vbulletin->options['nr_fid']
But if I put that code in directly "$vbulletin->options['nr_fid']" into the 5,6 it doesn't work. So should I explode it and get it out? I would assume the array command would be able to take it out from $vbulletin->options['nr_fid']
Dismounted
09-27-2008, 05:07 AM
There is a difference between:
array(5 ,6)
And:
array("5, 6")
The second is what you would be doing if you put a variable with "5, 6". It is considered one string. As you have done in your first post, explode it, and then just put it into in_array(), without wrapping another array around it.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.