3 replies [Last post]
fivepoints's picture
Offline
Getting busy with the Ubercode.
Joined: 09/26/2007
Juice: 258
Was this information Helpful?

hallo,
I need to know the user id on checkout page when an anonymous user has submitted the order (on cart/checkout/complete). in that page ubercart has created a new user and it prints the new username and the password associated: how can I read the user id?

thanks
nicola

fivepoints's picture
Offline
Getting busy with the Ubercode.
Joined: 09/26/2007
Juice: 258
If I use: <?phpfunction

If I use:

<?php
function mymodule_order($op, &$arg1, $arg2) {
  switch (
$op) {
    case
'submit':
    echo
$arg1->uid;
    break;
  }
}
?>

ubercart prints the user 0 (anonymous user) but I need the new user just created by ubercart.

mikejoconnor's picture
Offline
AdministratorBug FinderGetting busy with the Ubercode.
Joined: 08/07/2007
Juice: 536
Re: If I use: <?phpfunction

The user is created until the order is complete. Function uc_cart_complete_sale() is what performs the user creation magic.

You might want to look at using the update op in hook_order, which should be called with $arg1->order_status as 'post_checkout'.

No promises, but it's worth a try.

fivepoints's picture
Offline
Getting busy with the Ubercode.
Joined: 09/26/2007
Juice: 258
Re: Re: If I use: <?phpfunction

thanks! with this code it works!

<?php
function uc_cq_discounts_order($op, &$arg1, $arg2) {
  switch (
$op) {
    case
'update':
     
// here $arg1->uid is the new user id created.
     
break;
  }
}
?>