Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewlimaza/9cd05d768f53a388cd366b43419c783e to your computer and use it in GitHub Desktop.
Save andrewlimaza/9cd05d768f53a388cd366b43419c783e to your computer and use it in GitHub Desktop.
Remove Email Validation checks on Edit Member and Frontend Edit Profile page to allow updating of User Fields.
<?php
/**
* Removes the email validation checks on the Edit Member and Frontend Edit Profile pages.
* This allows pending validation members to edit their own User Fields.
* This is only needed if the "Restrict Fields For Membership Levels" option is selected.
*
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_email_bypass_validation_frontend() {
global $pmpro_pages;
if ( is_page( $pmpro_pages['member_profile_edit'] ) ) {
remove_action( 'pmpro_has_membership_level', 'pmproec_pmpro_has_membership_level', 10, 3 );
}
}
add_action( 'wp', 'my_pmpro_email_bypass_validation_frontend', 10 );
function my_pmpro_email_bypass_validation_backend() {
remove_action( 'pmpro_has_membership_level', 'pmproec_pmpro_has_membership_level', 10, 3 );
}
add_action( 'admin_init', 'my_pmpro_email_bypass_validation_backend', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment