Quote:
Originally Posted by King Kovifor
Sorry, known bug. I really really really need to finish this. * I need to get a life in coding again *.
|
Yeah... Well, since people want the fix here's the only problem...
I'm sure you used that for good reason, and later on in the plugin code you also (correctly) use
That's the same thing... So swapping them out resulted in the fix (I tested it, works great). In order to make this compatable with the e-mail activation here's the plugin code:
Plugin: Add Friend After Validation
Hook: register_activate_process
Code:
if(!empty($vbulletin->options['kk_auto_friends']))
{
$friends = explode(',', $vbulletin->options['kk_auto_friends']);
foreach($friends AS $friendid)
{
$db->query("INSERT INTO " . TABLE_PREFIX . "userlist (userid, relationid, type, friend) VALUES ({$userinfo['userid']}, {$friendid}, 'buddy', 'yes')");
if($vbulletin->options['kk_auto_friends_mutual'])
{
$db->query("INSERT INTO " . TABLE_PREFIX . "userlist (userid, relationid, type, friend) VALUES ({$friendid}, {$userinfo['userid']}, 'buddy', 'yes')");
}
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET friendcount = friendcount + 1 WHERE userid IN ($userinfo[userid], " . $vbulletin->userinfo['userid'] . ")");
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET friendcount = friendcount + 1 WHERE userid={$friendid}");
}
}
Plugin: Automatically Add Friend
Hook: register_addmember_complete
Code:
if(!empty($vbulletin->options['kk_auto_friends']) && !$vbulletin->options['verifyemail'])
{
$friends = explode(',', $vbulletin->options['kk_auto_friends']);
foreach($friends AS $friendid)
{
$db->query("INSERT INTO " . TABLE_PREFIX . "userlist (userid, relationid, type, friend) VALUES ({$userinfo['userid']}, {$friendid}, 'buddy', 'yes')");
if($vbulletin->options['kk_auto_friends_mutual'])
{
$db->query("INSERT INTO " . TABLE_PREFIX . "userlist (userid, relationid, type, friend) VALUES ({$friendid}, {$userinfo['userid']}, 'buddy', 'yes')");
}
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET friendcount = friendcount + 1 WHERE userid IN ($userinfo[userid], " . $vbulletin->userinfo['userid'] . ")");
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET friendcount = friendcount + 1 WHERE userid={$friendid}");
}
}
Cheers on the great mod, King Kovifor.