I am designing a system where a client buys my product, then gets access to members side of the site through CB login. Is there a standard way to create the user through a PHP script when the product is purchased.
I did find this script on the CBSubs forum, but can't make it work, perhaps it only works in CBSubs.
function registerUser( $fname, $lname, $email, $username, $password, $plan_id ) {
global $_CB_framework, $_CB_database;
$row = new moscomprofilerUser( $_CB_database );
$row->usertype = $_CB_framework->getCfg( 'new_usertype' );
$row->gid = $_CB_framework->acl->get_group_id( $row->usertype, 'ARO' );
$row->confirmed = 1;
$row->approved = 1;
$row->block = 0;
$row->sendEmail = 0;
$row->registerDate = date( 'Y-m-d H:i:s', $_CB_framework->now() );
$row->name = $fname . ' ' . $lname;
$row->first_name = $fname;
$row->last_name = $lname;
$row->username = $username;
$row->email = $email;
$row->password = cbHashPassword( $password );
if ( ! $row->store() ) {
trigger_error( 'Add User SQL error: ' . $row->getError(), E_USER_ERROR );
}
}
Thanks for any input!
Dom
Post edited by: djc, at: 2010/03/16 21:33
Post edited by: djc, at: 2010/03/16 22:35
Post edited by: djc, at: 2010/03/17 16:34