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

Only show user creation fields as restricted if they are actually needed. #3326

Conversation

dparker1005
Copy link
Member

All Submissions:

Changes proposed in this Pull Request:

Resolves #3165

Alternative to #3320

The pmpro_get_field_class() function has logic to show billing and user creation fields as required if they are set to be required during checkout. However, the checkout page template hardcoded the user creation fields to always show as required.

This PR removes the hardcoded logic in the checkout template to allow pmpro_get_field_class() to correctly control the required asterisk.

How to test the changes in this Pull Request:

Add this snippet and check whether the username and password fields are marked as required.
add_filter('pmpro_required_user_fields', 'custom_remove_required_user_fields', 10, 1); function custom_remove_required_user_fields($pmpro_required_user_fields) { unset($pmpro_required_user_fields['username']); unset($pmpro_required_user_fields['password']); unset($pmpro_required_user_fields['password2']); return $pmpro_required_user_fields; }

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run tests with your changes locally?

Changelog entry

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.

@MaximilianoRicoTabo
Copy link
Contributor

LGTM

@kimcoleman kimcoleman merged commit fc2b386 into strangerstudios:dev Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants