Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There is a patch to fix #1423482: Anonymous checkout for Recurring Product not listed properly under Subscription Manager and My Account already, but there is not anything to retroactively fix recurring orders that had already been affected by the bug. I've attached a drush script which will fix all of the old recurring orders that had a uid of 0.
To run the script simply drush scr fix_missing_users_for_recurring_orders.drush
after copying the following code into fix_missing_users_for_recurring_orders.drush
// Get all of the recurring orders with 0 for uid.
$query = db_query("SELECT rfid, order_id FROM {uc_recurring_users} WHERE uid=%d", 0);
// For each recurring order, get the uid.
while ($obj = db_fetch_object($query)) {
$order_uid = db_result(db_query("SELECT uid FROM {uc_orders} WHERE order_id=%d", $obj->order_id));
// Set the uid for the recurring order.
echo "Attempting to fix recurring order '" . $obj->rfid . "'\n";
$record = array(
'rfid' => $obj->rfid,
'uid' => $order_uid,
);
$query_success_status = drupal_write_record("uc_recurring_users", $record, 'rfid');
echo "Return status: $query_success_status\n";
}
Should this be rolled into the module with a version update?
Comment | File | Size | Author |
---|---|---|---|
#1 | uc_recurring-update-fee-uid-zero-2007252-1.patch | 1.09 KB | tinker |
Comments
Comment #1
tinker CreditAttribution: tinker commentedCreated patch with module update to find all fees with uid 0, where the order has a uid, and update the fees.
Apply patch using
git am uc_recurring-update-fee-uid-zero-2007252-1.patch