PDA

View Full Version : [php] member of usergroup


kennethj
10-01-2009, 11:58 AM
am trying to restrict access to an external script. right now have it for members of the forum only, need to make sure they have been added, not changed to a usergroup.


we are using this php in an external script to prevent access to people who do not have access to the forum right now:
if (!$vbulletin->userinfo['userid'])

$is_logged_in = true;
$username = $vbulletin->userinfo['username'];
$email = $vbulletin->userinfo['email'];

what we need to do is check if they are also a member of a usergroup also
( are adding the usergroup and Not changing it ).
<if condition="is_member_of($vbulletin->userinfo, 5)">
am not sure how to change this into the right php to achieve this.

thanks for any help .. .

Lynne
10-01-2009, 02:29 PM
That condition regarding usergroups is correct if it were in a template, but in a php page you would use:
if (is_member_of($vbulletin->userinfo, 5)) (And I don't understand your other code.... if no userid, then you set the $username to the vbulletin username... but if there is no userid, then there is no username, so I don't understand what you are trying to do. And you have no parenthesis which makes it harder to read cuz I'm assuming there should be some there?)

kennethj
10-03-2009, 10:46 AM
thanks, have it working now .. .

- the other code belongs to the rest of the script. whay? - not sure as did not wright the original one.. .