Created
December 29, 2017 22:10
-
-
Save ideadude/dead5a70b54d5812bce313b33e0c147f to your computer and use it in GitHub Desktop.
Stop users from setting their username to an email address with Paid Memberships Pro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Stop users from setting their username to an email address | |
Add this code to a custom plugin. | |
*/ | |
function pmpro_registration_checks_no_email_user_login($continue) { | |
//if there are earlier problems, don't bother checking | |
if(!$continue) | |
return; | |
//make sure the username passed in doesn't look like an email address (contains a @) | |
global $username; | |
if(!empty($username) && strpos($username, "@") !== false) { | |
$continue = false; | |
pmpro_setMessage( 'Your username must not be an email address', 'pmpro_error" ); | |
} | |
return $continue; | |
} | |
add_filter('pmpro_registration_checks', 'pmpro_registration_checks_no_email_user_login'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made a change on line 14 where it states:
'pmpro_error" to 'pmpro_error'
Link for reference: https://gist.github.com/travislima/ac1d81cde09eca7f201223cc0a7c0877