Support » Plugin: Paid Memberships Pro » Renewal's first and last name being wiped out

  • Hello,

    Having a couple issues with client’s PMPRO’s member renewal checkout.

    1) Members were receiving a required fields message that prevented them from checking out. I did not setup the site initially but found the required fields in the pmpro-register-helper-fields directory. It seems as though the renewal checkout was looking for these fields, but they aren’t even needed on the page; the member already submitted them when they signed up. So why require it again if the form field isn’t even present on the page.

    I “fixed” this by modifying the code to check if the user was logged in. If they were, than to ignore the requirements. Members can now checkout.

    2) Now that members can renew we’re seeing that first and last name fields of the members are now being cleared out when they do. Before I go digging into whatever is happening, I just wanted to know if there is a quick fix. Makes me think there is a blanket update statement that is being run regardless of signup or renewal.

    Any help would be greatly appreciated.

    Thanks,

    Andrew

    https://wordpress.org/plugins/paid-memberships-pro/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jason Coleman

    (@strangerstudios)

    If the first and last name fields are added in via register helper to the “after_username” or “after_password” etc slots, those slots aren’t visible when a user is already logged in. However RH still “requires” them.

    We’ve been thinking to add code to handle this situation, but the easy fix is to make sure the first/last name shows up in the default “checkout_boxes” location or one that is always visible.

    You should also be able to add something like you did that checks if a user is logged in and if so, doesn’t require the first and last name.

    I don’t believe it would overwrite their first and last name though. Can you share the code you are using to add the fields at gist.github.com or something similar so we can test?

    Jason,

    Thank you for the helpful information. I can definitely include the code. Can you please confirm which file(s) you need me to share with you?

    Thanks,

    Andrew Jordan

    Nevermind – I found this chunk of code at the end of the pmpro-register-helper-fields.php file that for some reason was trying to update the first and last name. I’ve commented it out, and now first and last names are not being erased.

    This isn’t part of the original plug-in code right? I’m assuming a prior developer wrote this:

    //update the user after checkout
    /*function pmproan2c_update_first_and_last_name_after_checkout($user_id)
    {
            if(!empty($_REQUEST['first_name']))
                    $first_name = $_REQUEST['first_name'];
            elseif(!empty($_SESSION['first_name']))
                    $first_name = $_SESSION['first_name'];
            else
                    $first_name = "";
    
            if(!empty($_REQUEST['last_name']))
                    $last_name = $_REQUEST['last_name'];
            elseif(!empty($_SESSION['last_name']))
                    $last_name = $_SESSION['last_name'];
            else
                    $last_name = "";
            update_user_meta($user_id, "first_name", $first_name);
            update_user_meta($user_id, "last_name", $last_name);
    }
    add_action('pmpro_after_checkout', 'pmproan2c_update_first_and_last_name_after_checkout');
    function pmproan2c_pmpro_paypalexpress_session_vars()
    {
            //save our added fields in session while the user goes off to PayPal
            $_SESSION['first_name'] = $_REQUEST['first_name'];
            $_SESSION['last_name'] = $_REQUEST['last_name'];
    }
    add_action("pmpro_paypalexpress_session_vars", "pmproan2c_pmpro_paypalexpress_session_vars");*/

    Jason,

    Despite my efforts, it looks like PMPRO is still erasing the user’s first and last name when they go off to PayPal Express. Can you please take a look at the code and let me know if you spot any glaring issues?

    I posted what I think are the two files responsible for these transactions below.

    https://gist.github.com/anonymous/2eb78d4ac836863edef1

    Thank you for any and all help. I know you’re busy!

    Andrew

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Renewal's first and last name being wiped out’ is closed to new replies.