The following patch seems to effectively prevent Ubercart from creating a Drupal user for anonymous checkouts. It's not as complete a solution as the patch that started this thread, but one advantage is that it only requires two very small changes to a single Ubercart file:
--- a/sites/default/modules/ubercart/uc_cart/uc_cart.module
+++ b/sites/default/modules/ubercart/uc_cart/uc_cart.module
@@ -1117,7 +1117,11 @@ function uc_cart_complete_sale($order, $login = FALSE) {
global $user;
// Logic to create new user if necessary:
- if ($order->uid == 0) {
+ // CC doesn't want Ubercart to create a new Drupal user so let's set
+ // this if statement to something that will never evaluate to true.
+ // If uid is ever ROFL! then I'll quit my job and paddle off into
+ // the Pacifc in a canoe. (nkinkade 2009-06-17)
+ if ($order->uid == 'ROFL!') {
// Check for an existing user account with the e-mail address from checkout.
$result = db_query("SELECT uid FROM {users} WHERE mail = '%s'", $order->primary_email);
@@ -1209,7 +1213,9 @@ function uc_cart_complete_sale($order, $login = FALSE) {
// Clear our the session variables used to force the cart workflow.
unset($_SESSION['cart_order'], $_SESSION['do_complete'], $_SESSION['new_user']);
- ca_pull_trigger('uc_checkout_complete', $order, $user->uid == 0 ? $account : $user);
+ // Compare uid against -1 which will always fail, forcing the use of $user.
+ // (nkinkade 2009-06-17)
+ ca_pull_trigger('uc_checkout_complete', $order, $user->uid == -1 ? $account : $user);
return $output;
}
--Nathan
