'.__("Error","sakurairo")./*错误*/':'.__("Please enter username.","sakurairo")./*请输入用户名。*/'
';
} elseif ( ! validate_username( $sanitized_user_login ) ) {
$error .= ''.__("Error","sakurairo")./*错误*/':'.__("Invalid characters, please enter a valid username.","sakurairo")./*此用户名包含无效字符,请输入有效的用户名。*/'
';
$sanitized_user_login = '';
} elseif ( username_exists( $sanitized_user_login ) ) {
$error .= ''.__("Error","sakurairo")./*错误*/':'.__("This username has been registered.","sakurairo")./*该用户名已被注册。*/'
';
}
// Check the e-mail address
if ( $user_email == '' ) {
$error .= ''.__("Error","sakurairo")./*错误*/':'.__("Please enter email address.","sakurairo")./*请填写电子邮件地址。*/'
';
} elseif ( ! is_email( $user_email ) ) {
$error .= ''.__("Error","sakurairo")./*错误*/':'.__("Invalid email address.","sakurairo")./*电子邮件地址不正确。*/'
';
$user_email = '';
} elseif ( email_exists( $user_email ) ) {
$error .= ''.__("Error","sakurairo")./*错误*/':'.__("This email address has been registered.","sakurairo")./*该电子邮件地址已经被注册。*/'
';
}
// Check the password
if(strlen($_POST['user_pass']) < 6){
$error .= ''.__("Error","sakurairo")./*错误*/':'.__("Password length is at least 6 digits.","sakurairo")./*密码长度至少6位。*/'
';
}elseif($_POST['user_pass'] != $_POST['user_pass2']){
$error .= ''.__("Error","sakurairo")./*错误*/':'.__("Inconsistent password entered twice.","sakurairo")./*两次输入的密码不一致。*/'
';
}
if($error == '') {
$user_id = wp_create_user( $sanitized_user_login, $_POST['user_pass'], $user_email );
if ( !$user_id ) {
$error .= ''.__("Error","sakurairo")./*错误*/':'.__("Unable to complete registration request...Please contact","sakurairo")./*无法完成注册请求... 请联系*/''.__("administrator","sakurairo")./*管理员*/'!
';
}else if (!is_user_logged_in()) {
$user = get_userdatabylogin($sanitized_user_login);
$user_id = $user->ID;
// 自动登录
wp_set_current_user($user_id, $user_login);
wp_set_auth_cookie($user_id);
do_action('wp_login', $user_login);
}
}
}
?>