I'm trying to put together a simple plugin that will add a connection to a user automatically when someone registers.
I can't post in the member categories until I can get my membership renewed but thought it was worth a shot posting here anyway.
Here's my plugin code, it installs fine, it just doesn't work lol. I've tried both onAfterUserRegistrationSave and onUserActive, let me know if anything stands out:
Code:
$_PLUGINS->registerFunction( 'onUserActive', 'addConnection', 'getautoConnectTab' );
class getautoConnectTab extends cbTabHandler {
/**
* Construnctor
*/
function getautoConnectTab() {
$this->cbTabHandler();
}
/**
* Makes the connection
*/
function addConnection($user) {
global $_CB_database,$_CB_framework;
$userid = $user->id;
$membersince = date("Y-m-d");
$sql="INSERT INTO #__comprofiler_members (referenceid, memberid, accepted, pending, membersince) VALUES ('340', '$userid', '1', '0', '$membersince')";
$_CB_database->SetQuery($sql);
$sql="INSERT INTO #__comprofiler_members (referenceid, memberid, accepted, pending, membersince) VALUES ('$userid', '340', '1', '0', '$membersince')";
$_CB_database->SetQuery($sql);
return true;
}
} // end of autoConnectTab class
?>