Easy-digital-downloads: User ID marked as -1 for payment with same email, but different other data

Created on 27 May 2015  路  14Comments  路  Source: easydigitaldownloads/easy-digital-downloads

Recently, a bug surfaced, where user ID for payments with same email, but different other data gets stamped as -1 and doesn't get existing user ID per email assigned. In admin, this is marked as guest payment, but this "guest" gets user id -1 assigned, whereas it should get ID from existing user with same email address.

Check this:

edd_get_payment_user_id( $payment_id ); // returns -1

type-bug

All 14 comments

There doesn't appear to be a bug here. edd_get_payment_user_id returns -1, which is user id of a guest user in EDD when the payment isn't attached to a customer. If they didn't login, regardless of the fact they have an account on your site with the same email, that's a guest purchase, and EDD treats it as such.

This is definitely a bug. When user goes to see the purchase history in his account, he cannot see anything for purchase, where he was marked as guest. Transaction is shown, but he can't see the receipt page as this error is shown: "Sorry, trouble retrieving payment receipt."

No, its doing exactly what it's designed to do. If a user is not logged in while purchasing a product, that is a guest purchase. Ergo when they login to their account it will not show up because it is a guest purchase. I think the only thing that needs to be fixed here is that the transaction should not show for the logged in user, as it was a guest purchase account. If you want to force users to login, and thus force tie payments to accounts, you can disable the guest checkout feature on the settings panel

Say what you want, but I'll call it a bug. Why aren't other purchases marked as "guest", even though registration process is the same (not logged in) - only marked as guest when user data submitted on second purchase is different from first one and email is the same. Customer details are shared in admin and shown correctly, but not in the front-end, where edd_get_payment_user_id( $payment_id ); returns -1.

There is a potential issue here, but it's not with the edd_get_payment_user_id() function. The issue you're eluding to, @bizzthemes, is that the payment did not get connected to the user account when it should have.

Are you seeing this with new purchases that are coming through or existing purchases that were there before the upgrade to EDD 2.3?

Issue was not present before 2.3. Thanks @pippinsplugins for clarification. I only used edd_get_payment_user_id() to highlight the issue.

the payment did not get connected to the user account when it should have.

Exactly. Why mark the user with ID -1, when email is the same. Perhaps it would be great to prompt user to login, when they try to register with email address that already exists.

@bizzthemes You didn't answer my question. Is this happening with new purchase records or existing ones only?

New ones. I'd suggest testing it out yourself and you'll quickly be able to debug it. Simply create a new purchase (when logged out) with email that is already registered, but change user's name.

Does a customer record exist in Downloads > Customers for the new email you're using?

yes

Can you show me a print_r( get_post_custom( $payment_id ) ) for each?

The problem also occurs when user buying and is registred by EDD Auto Register (I didn't test without it) and than when status is changed manually. User on purchase list is changed to Guest.

I'm not sure if this still happens but I've milestoned it to ensure we review it further.

Having done numerous tests recently with the Recurring Payments plugin and the Auto Register plugin, I'm confident this issue is resolved. If you see it again, please re-open.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scottbuscemi picture scottbuscemi  路  5Comments

julien731 picture julien731  路  5Comments

davidsherlock picture davidsherlock  路  5Comments

mikeyhoward1977 picture mikeyhoward1977  路  5Comments

DrewAPicture picture DrewAPicture  路  5Comments