Created
December 9, 2019 10:56
-
-
Save dparker1005/9b29c01caddfde034f6ad3c201f04014 to your computer and use it in GitHub Desktop.
Do not allow users to use an email as their username
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
<?php | |
// Copy from below here... | |
/* | |
* Do not allow users to use an email as their username | |
*/ | |
function my_pmpro_registration_checks_no_email_in_username($okay) | |
{ | |
if(!$okay) | |
return $okay; //there are other errors to handle | |
global $pmpro_msg, $pmpro_msgt; | |
$username = $_REQUEST['username']; | |
//make sure they entered any birthday | |
if( ! empty($username) && strpos( $username, '@') !== false ) | |
{ | |
$pmpro_msg = "You cannot use an email address as your username."; | |
$pmpro_msgt = "pmpro_error"; | |
return false; | |
} | |
return $okay; | |
} | |
add_filter("pmpro_registration_checks", "my_pmpro_registration_checks_no_email_in_username"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment