Skip to content

Instantly share code, notes, and snippets.

@teolopez
Created January 18, 2014 20:02
Show Gist options
  • Save teolopez/8495440 to your computer and use it in GitHub Desktop.
Save teolopez/8495440 to your computer and use it in GitHub Desktop.
// Register Error if ID code does not match. for functions.php
//----------------------------------------------
// Register Error if ID code does not match.
//----------------------------------------------
function myplugin_check_fields($errors, $sanitized_user_login, $user_email) {
$mystring = $user_email;
$findme = '.edu';
$pos = strpos($mystring, $findme);
if ( ! $pos === false)
$errors->add( 'email_domain_error', __('<strong>ERROR</strong>: Please provide a non .edu email.','mydomain') );
//if ( ! preg_match('/^(\d{5}(\d{4})?)?$/', $_POST['registrationcode']) )
//$registerKey = $_POST['registrationcode'];
//if ( ! $registerkey == '123' )
if ( ! preg_match('/^7891gza!/', $_POST['registrationcode']) )
$errors->add( 'registerkey_error', __('<strong>ERROR</strong>: Enter a valid registration code.','mydomain') );
return $errors;
// if ( strpos('.edu', $_POST['user_email']) )
// $errors->add( 'email_domain_error', __('<strong>ERROR</strong>: Please provide a non .edu email.','mydomain') );
// return $errors;
// if ( ! preg_match('/^(\d{5}(\d{4})?)?$/', $_POST['registrationcode']) )
// $errors->add( 'registerkey_error', __('<strong>ERROR</strong>: Enter a valid registration code.','mydomain') );
// return $errors;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment