Hi there .
I have this code which promotion alexa toolbar users to another group .
put it by a secondary group .
I want to promotion users to a primary group .
here is the code :
And the hack Attached .
I have this code which promotion alexa toolbar users to another group .
put it by a secondary group .
I want to promotion users to a primary group .
here is the code :
PHP:
function is_not_alexa_usergroup($usergroupid)
{
global $vbulletin;
if ($usergroupid == $vbulletin->options['alexa_users_rewarding_usergroup'])
{
return false;
}
else
{
return true;
}
}
function add_to_alexa_usergroup($userinfo)
{
global $vbulletin;
$user_is_a_member_in = array();
$user_is_a_member_in = explode(',', $userinfo['membergroupids']);
$user_is_a_member_in[] = $vbulletin->options['alexa_users_rewarding_usergroup'];
$user_is_a_member_in = array_unique($user_is_a_member_in);
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($userinfo);
$userdata->set('membergroupids', implode(',', $user_is_a_member_in));
$userdata->set('displaygroupid', $vbulletin->options['alexa_users_rewarding_usergroup']);
$userdata->save();
unset($user_is_a_member_in);
}
function remove_from_alexa_usergroup($userinfo)
{
global $vbulletin;
$user_is_a_member_in = array();
$user_is_a_member_in = explode(',', $userinfo['membergroupids']);
$user_is_a_member_in = array_filter($user_is_a_member_in, 'is_not_alexa_usergroup');
$user_is_a_member_in = array_unique($user_is_a_member_in);
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($userinfo);
$userdata->set('membergroupids', implode(',', $user_is_a_member_in));
$userdata->set('displaygroupid', 0);
$userdata->save();
unset($user_is_a_member_in);
}
function is_member_of_alexa_usergroup($userinfo)
{
global $vbulletin;
return is_member_of($userinfo, $vbulletin->options['alexa_users_rewarding_usergroup']);
}
function has_alexa_toolbar($useragent)
{
if (strpos($useragent, 'Alexa Toolbar') === false)
{
return false;
}
else
{
return true;
}
}
function mark_as_alexa_toolbar_user($musername)
{
global $vbulletin, $vbphrase;
return $musername . ' <img src="' . $vbulletin->options['bburl'] . '/images/alexa.gif" alt="' . $vbphrase['alexa_toolbar_user'] . '" border="0" align="middle" />';
}
if (has_alexa_toolbar($_SERVER['HTTP_USER_AGENT']))
{
$reward_user = true;
}
else
{
$reward_user = false;
}
And the hack Attached .