PDA

View Full Version : User rank code stopped working


eXoOutsider
04-09-2014, 03:32 PM
Some of our code has stopped working out of the blue, I'm wondering if a syntax change has been made or something?

Hook: member_complete


if ($userinfo['usergroupid'] == '42')
{

$prepared_bypass = $vbulletin->db->query_first("SELECT field54 FROM userfield WHERE userid='" . $userinfo[userid] . "'");

if ($prepared_bypass['field54'] == 'grey')
{
$prepared['rank'] = '<img src="/forums/images/elite_user_ranks/userbar-elite-grey.png" alt="NextGenUpdate Elite Member" border="0" />';
}
if ($prepared_bypass['field54'] == 'red')
{
$prepared['rank'] = '<img src="/forums/images/elite_user_ranks/userbar-elite-red.png" alt="NextGenUpdate Elite Member" border="0" />';
}
}


It's meant to update their user ranks on the profile pages but it's just not doing it. Got an equivalent version for threads and that is working.

eXoOutsider
04-15-2014, 10:13 AM
Can anyone help?

Elite_360_
04-17-2014, 10:39 PM
You should not have to run a query since $userinfo will have all the users data.
The code below will work fine


if ($userinfo['usergroupid'] == '42')
{
if ($userinfo['field54'] == 'grey')
{
$prepared['rank'] = '<img src="/forums/images/elite_user_ranks/userbar-elite-grey.png" alt="NextGenUpdate Elite Member" border="0" />';
}
if ($userinfo['field54'] == 'red')
{
$prepared['rank'] = '<img src="/forums/images/elite_user_ranks/userbar-elite-red.png" alt="NextGenUpdate Elite Member" border="0" />';
}
}


--------------- Added 1397778374 at 1397778374 ---------------

the code you have works on my forum "vb 4.2.2 pl 1" but use my code you don't need the query

--------------- Added 1397778920 at 1397778920 ---------------

if they are in multiply usergroups i would use this




if (is_member_of($userinfo, 42))
{
if ($userinfo['field54'] == 'grey')
{
$prepared['rank'] = '<img src="/forums/images/elite_user_ranks/userbar-elite-grey.png" alt="NextGenUpdate Elite Member" border="0" />';
}
if ($userinfo['field54'] == 'red')
{
$prepared['rank'] = '<img src="/forums/images/elite_user_ranks/userbar-elite-red.png" alt="NextGenUpdate Elite Member" border="0" />';
}
}