drew010
06-27-2006, 07:47 PM
if ($foruminfo['forumid'] == 38)
{
require_once(DIR . '/includes/functions_user.php');
require_once(DIR . '/includes/functions_databuild.php');
$userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
$user = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE `userid`=".$db->sql_prepare($vbulletin->userinfo['userid']));
$userdm->set_existing($user);
$splitvotes = explode('|||', $pollinfo['votes']);
if ($vbulletin->GPC['optionnumber'] == 1)
{
$splitvotes[0] += 1;
}
if ($splitvotes[0] >= 1)
{
if ((!in_array('9', explode(',', $user['membergroupids']))) && ($user['usergroupid'] != '9'))
{
if ($user['usergroupid'] == '4')
{
$user['usergroupid'] = '9';
} else {
$membergroups = explode(',', $user['membergroupids']);
$membergroups[] = '9';
$user['membergroupids'] = implode(',', $membergroups);
}
$userdm->set('usergroupid', $user['usergroupid']);
$userdm->set('membergroupids', $user['membergroupids']);
$userdm->save();
}
}
}
Basically if it's in forum 38, and the user get's => 1 vote, they get promoted to group 9. It updates in phpMyAdmin, so I know it works, but in order to get the rank to appear I have to hit 'Update User Ranks and Titles'. I tried taking the relevant part of that process from misc.php and using it to my own advantage, but to no avail; I simply can NOT get it to update. Any help appreciated!
{
require_once(DIR . '/includes/functions_user.php');
require_once(DIR . '/includes/functions_databuild.php');
$userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
$user = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE `userid`=".$db->sql_prepare($vbulletin->userinfo['userid']));
$userdm->set_existing($user);
$splitvotes = explode('|||', $pollinfo['votes']);
if ($vbulletin->GPC['optionnumber'] == 1)
{
$splitvotes[0] += 1;
}
if ($splitvotes[0] >= 1)
{
if ((!in_array('9', explode(',', $user['membergroupids']))) && ($user['usergroupid'] != '9'))
{
if ($user['usergroupid'] == '4')
{
$user['usergroupid'] = '9';
} else {
$membergroups = explode(',', $user['membergroupids']);
$membergroups[] = '9';
$user['membergroupids'] = implode(',', $membergroups);
}
$userdm->set('usergroupid', $user['usergroupid']);
$userdm->set('membergroupids', $user['membergroupids']);
$userdm->save();
}
}
}
Basically if it's in forum 38, and the user get's => 1 vote, they get promoted to group 9. It updates in phpMyAdmin, so I know it works, but in order to get the rank to appear I have to hit 'Update User Ranks and Titles'. I tried taking the relevant part of that process from misc.php and using it to my own advantage, but to no avail; I simply can NOT get it to update. Any help appreciated!