PDA

View Full Version : conditional for usertools.php


Senti.Jatt
08-14-2009, 06:37 PM
PROBLEM solved thanks to lynne and Redlinemotorsports

Lynne
08-14-2009, 06:39 PM
I think you want to use $bbuserinfo as that is related to the person trying to view the page.

Senti.Jatt
08-14-2009, 07:08 PM
^ not person trying to view the page to but something like

if (!$userinfo OR if (is_member_of($userinfo, 6))

I want no result found for usergroup 6
even if usergroup 6 searches it

Lynne
08-14-2009, 07:18 PM
Who is the condition supposed to work on? And where are you adding this code (line number and perhaps a couple of lines of code above and below it, please).

Senti.Jatt
08-14-2009, 07:21 PM
if ($vbulletin->GPC['username'])
{
$getuserid = $db->query_first("
SELECT userid
FROM " . TABLE_PREFIX . "user
WHERE username = '" . $db->escape_string(htmlspecialchars_uni($vbulletin->GPC['username'])) . "'
");
$userid = intval($getuserid['userid']);

$userinfo = fetch_userinfo($userid);
if (!$userinfo OR is_member_of($userinfo, 6));
{
print_stop_message('protected_user');
}
}
else if ($vbulletin->GPC['userid'])
{
$userid = $vbulletin->GPC['userid'];
$userinfo = fetch_userinfo($userid);
if (!$userinfo OR is_member_of($userinfo, 6));
{
print_stop_message('protected_user');
}
$vbulletin->GPC['username'] = unhtmlspecialchars($userinfo['username']);
}


When someone searches for x user's ip address(x user is in usergroup 6)
it should come up with something like No results found
i know how to add error message but can't make conditional to work

Lynne
08-14-2009, 09:39 PM
Why are you putting a ; at the end of the if condition? It won't continue.

Should be:
if (!$userinfo OR is_member_of($userinfo, 6))

Senti.Jatt
08-14-2009, 09:50 PM
^ dude you are the best

HMBeaty
08-14-2009, 09:56 PM
Try this...
if (!is_member_of($vbulletin->userinfo, 6))
{
print_stop_message('protected_user');
}

Senti.Jatt
08-14-2009, 10:22 PM
^ thanks but lynne one has worked fine
yours will only disable ip's for usergroup 6 but i wont show an error when we mistype a username

Thanks very much guys