0

I have a site running Paid Membership Pro and I'm adding a user membership level via a Webhook from Chargify. I use a function in the Stranger Studios Multiple Memberships Per User plugin https://github.com/strangerstudios/pmpro-multiple-memberships-per-user to add the membership level. These users already have an account and role assigned to them, they are just having another membership level assigned.

The weird thing is it adds the level however, the end user doesn't have access to the content until I manually edit the user profile and click Update User button. No changes are needed in their profile just to open their user account and click the button.

I've tried running the Wordpress wp_update_user() function after adding the membership level and running cURL post to /wp-admin/user-edit.php but still I need to manually save the user profile before they gain access to content.

Any help would be extremely appreciated.

4
  • I can't tell for sure, but my assumption is that the added users have no role assigned to them. When you click "Update Profile", it will add assign a role since the select box most likely has a default value, even if nothing is selected before.
    – Johansson
    Commented Aug 30, 2018 at 8:41
  • Sorry - I should have mentioned the users already have a role and account on the site
    – Nick
    Commented Aug 30, 2018 at 9:26
  • How is the membership level saved? Is it a role, or some type of custom usermeta?
    – WebElaine
    Commented Aug 30, 2018 at 13:39
  • Paid Membership Pro creates several tables in the database one being wp_pmpro_memberships_users which holds the user_id and membership_id. However, I haven't checked what the difference between a code loaded row and saved user row is which I'll do now. Thank you! This could be a step in the right direction. :)
    – Nick
    Commented Aug 31, 2018 at 9:24

1 Answer 1

0

Thanks must go to WebElaine as her comment lead me on the right path to solving this.

The issue was when the pmprommpu_addMembershipLevel() adds the membership level it sets the endate to 0000-00-00 00:00:00 running a $wpdb->update to set this to NULL fixed the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.