Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dparker1005/9b29c01caddfde034f6ad3c201f04014 to your computer and use it in GitHub Desktop.
Save dparker1005/9b29c01caddfde034f6ad3c201f04014 to your computer and use it in GitHub Desktop.
Do not allow users to use an email as their username
<?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