strangerstudios / pmpro-add-name-to-checkout

Adds “First Name” and “Last Name” fields to the “Account Information” section of the Membership Checkout page when using Paid Memberships Pro.
https://www.paidmembershipspro.com/add-ons/add-first-last-name-to-checkout/
17 stars 23 forks source link

Accepts empty first and last name values for logged in users. #15

Closed ipokkel closed 4 years ago

ipokkel commented 4 years ago

When an existing user or active member checks out or changes a level and the first_name and last_name fields are empty the registration is still accepted.

Should we perhaps consider validating only against the variables $first_name and $last_name as existing data for these are assigned to values for these variables at the beginning of pmproan2c_pmpro_registration_checks here https://github.com/strangerstudios/pmpro-add-name-to-checkout/blob/5ff8976ca2e5e848162165adad84e37c8729ab09/pmpro-add-name-to-checkout.php#L83-L84 and here https://github.com/strangerstudios/pmpro-add-name-to-checkout/blob/5ff8976ca2e5e848162165adad84e37c8729ab09/pmpro-add-name-to-checkout.php#L93-L94

Change

    if ( $first_name && $last_name || $current_user->ID ) {
        //all good
        return true;
    }

to

    if ( $first_name && $last_name ) {
        //all good
        return true;
    } 

Reference: https://github.com/strangerstudios/pmpro-add-name-to-checkout/blob/5ff8976ca2e5e848162165adad84e37c8729ab09/pmpro-add-name-to-checkout.php#L99