Log in

View Full Version : is_member_of issue, need some help


Trek
07-27-2009, 07:00 PM
So I'm doing a really simple check to see if a member has a specific usergroup, but it's failing. Here's the code I'm using:

<if condition="is_member_of($vbulletin->userinfo, $vbulletin->options['gm_ugl_view_chars'])">

The value is set within the options like any other mod.

If the value contains only a single number, it works fine. If the value has more than one group, the condition fails for all groups. So, using "6" works fine, using "6, 15" fails.

Seems to work ok if I hardcode the values 6, 15 however. So I'm not really sure where my problem is. Since this is an array, I'm not sure how to print out the value of $vbulletin->options['gm_ugl_view_chars'] to test it (even though the value is good in the settings).

Thanks for your help!

HMBeaty
07-27-2009, 07:59 PM
If you're trying to add this to add a custom page, you could add the following code to your php file...
if (is_member_of($vbulletin->userinfo, explode(',',$vbulletin->options['gm_ugl_view_chars'])))
{
print_no_permission() or whatever you want to do;
}

Trek
07-27-2009, 08:13 PM
If you're trying to add this to add a custom page, you could add the following code to your php file...
if (is_member_of($vbulletin->userinfo, explode(',',$vbulletin->options['gm_ugl_view_chars'])))
{
print_no_permission() or whatever you want to do;
}

Actually, this is within the postbit_legacy template.

Zachery
07-27-2009, 08:27 PM
Is this supposed to check the user browsing the site, or the persons whos post it is?

$bbuserinfo for person viewing the site
$post for the person who the post belongs to,.

Trek
07-27-2009, 08:34 PM
Is this supposed to check the user browsing the site, or the persons whos post it is?

$bbuserinfo for person viewing the site
$post for the person who the post belongs to,.

The person viewing the site.

I just tried two different things and each failed (didn't fire the condition):

<if condition="is_member_of($bbuserinfo, $vbulletin->options[gm_ugl_view_chars])">

and

<if condition="is_member_of($bbuserinfo, $vbulletin->options['gm_ugl_view_chars'])">

Only difference was the single quotes around the option name. I checked my options and gm_ugl_view_chars is set to "6, 15" no quotes.

Lynne
07-27-2009, 09:21 PM
$vboptions should be used in templates, not $vbulletin->options. Also, if it is an array, then you need to explode it prior to use which means you may need a plugin to do so.

Trek
07-27-2009, 09:52 PM
Ok, I finally got this working thanks to the help from everyone. Thank you all. =)