Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User fields are not being saved during checkout for PayPal Standard #2597

Open
3 tasks done
andrewlkho opened this issue Aug 22, 2023 · 6 comments
Open
3 tasks done

Comments

@andrewlkho
Copy link

Describe the bug
Custom user fields created either using the admin interface or in code are displayed correctly on the membership sign-up page. However, these do not get saved to the database in the wp_usermeta table. I suspect that this is to do with the PayPal Standard gateway which is being used on the site in question.

To Reproduce
Steps to reproduce the behavior:

  1. Instal Paid Memberships Pro and use the PayPal Standard gateway
  2. Create a custom user field either in code or using the admin interface
  3. Attempt to sign up as a new user and checkout with Paypal
  4. Review the database for the custom user field

Expected behaviour
The value of the submitted user field is saved in the wp_usermeta table.

Isolating the problem (mark completed items with an [x]):

  • I have deactivated other plugins and confirmed this bug occurs when only Paid Memberships Pro plugin is active.
  • This bug happens with a default WordPress theme active, or Memberlite.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

  • WordPress version: 6.3
  • Paid Memberships Pro version: 2.12.2
@andrewlkho
Copy link
Author

andrewlkho commented Aug 22, 2023

From my limited knowledge of Paid Memberships Pro, I suspect that this is due to how the PayPal Standard gateway workflow operates. It looks to me like:

  1. The pmpro_before_send_to_paypal_standard action runs the pmpro_after_checkout_save_fields function in includes/fields.php
  2. This checks if that field should be saved for the level being checked out by calling:
if ( ! pmpro_check_field_for_level( $field, "profile", $user_id ) ) {
    continue;
}
  1. pmpro_check_field_for_level with those arguments checks to see if the submitted field's specified levels are one that the $user_id holds.

In the case of the PayPal Standard workflow, as the pmpro_before_send_to_paypal_standard hook's name suggests, this is run before going to PayPal to checkout. Therefore, in step (3) it returns false because the field's allowed level's are not one that the current user ID holds, as the user has not yet checked out to acquire that level. Thus the field is not saved.

I have temporarily fixed this in my instance by changing the line in step 2 to:

if ( ! pmpro_check_field_for_level( $field, "default", $user_id ) ) {
    continue;

but I am unclear on other ramifications of this.

@andrewlimaza
Copy link
Contributor

@andrewlkho Sorry to hear about this issue you are facing here. Are you still facing this issue? I am going to try and replicate this issue before updating this issue status.

If you are still facing issues, I recommend to use PayPal Express instead. The only additional information needed would be more merchant details but any PayPal account that supports Standard can use Express.

@andrewlimaza
Copy link
Contributor

Thanks for your patience @andrewlkho, all this information helps. I was able to replicate this and it needs to be resolved. We do recommend PayPal Express over PayPal Standard - https://www.paidmembershipspro.com/read-using-paypal-standard-paid-memberships-pro/

However, we are going to look into a solution for this.

@MaximilianoRicoTabo
Copy link
Contributor

this isn't reproducing for me in v3.0.4. User fields are stored just fine with paypal standard gateway @andrewlimaza

@ipokkel
Copy link
Member

ipokkel commented Jun 6, 2024

Received a report of textarea fields not saving when using PayPal Standard: #568735 (User resolved the issue by switching to PayPal Express)

@ipokkel
Copy link
Member

ipokkel commented Jun 6, 2024

User reported user fields are not saving when using PayPal Standard: #573404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants