Re: Re: Checkout with new user - not storing entered password or

madwinchester's picture
Offline
Joined: 12/04/2007
Juice: 5
Re: Re: Checkout with new user - not storing entered password or

I decided rather than fiddling with extra tables/fields, I would simply make it add the user before sending them off to paypal. So I have added the following code just after line 150 of uc_cart_checkout_pane.inc

$fields = array(
'name' => $_SESSION['new_user']['name'],
'mail' => $arg2['primary_email'],
'init' => $arg2['primary_email'],
'pass' => $_SESSION['new_user']['pass'],
'roles' => array(),
'status' => variable_get('uc_new_customer_status_active', TRUE) ? 1 : 0,
);
$user = user_save('', $fields);
$tmpQuery = db_query("update {uc_cart_products} set cart_id = %d WHERE cart_id = '%s'", $user->uid, session_id());

It appears to work fine. It's probably not the cleanest way to do it as I haven't bothered to remove the code that sets the session vaiables up, but other than that, do you see any potential issues with it?

Kind Regards,

Matt Winchester