From 151e726b7bb00a3f46a64bb10c71011bd56dca34 Mon Sep 17 00:00:00 2001 From: donncha Date: Wed, 13 Jul 2005 16:52:09 +0000 Subject: Merge from WP Core, things are broken right now. git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@20 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-inst/wp-register.php | 129 +++++++++++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 57 deletions(-) (limited to 'wp-inst/wp-register.php') diff --git a/wp-inst/wp-register.php b/wp-inst/wp-register.php index 4a3e0d3..327c7fc 100644 --- a/wp-inst/wp-register.php +++ b/wp-inst/wp-register.php @@ -14,47 +14,52 @@ case 'register': $user_login = sanitize_user( $_POST['user_login'] ); $user_email = $_POST['user_email']; + + $errors = array(); if ( $user_login == '' ) - die (__('ERROR: Please enter a username.')); + $errors['user_login'] = __('ERROR: Please enter a username.'); /* checking e-mail address */ if ($user_email == '') { - die (__('ERROR: Please type your e-mail address.')); + $errors['user_email'] = __('ERROR: Please type your e-mail address.'); } else if (!is_email($user_email)) { - die (__('ERROR: The email address isn’t correct.')); + $errors['user_email'] = __('ERROR: The email address isn’t correct.'); } - if ( username_exists( $user_login ) ) - die (__('ERROR: This username is already registered, please choose another one.')); + if ( username_exists( $user_login ) ) + $errors['user_login'] = __('ERROR: This username is already registered, please choose another one.'); - $user_level = get_settings('new_users_can_blog'); $password = substr( md5( uniqid( microtime() ) ), 0, 7); - $user_id = create_user( $user_login, $password, $user_email, $user_level ); - - do_action('user_register', $user_id); - + $user_id = create_user( $user_login, $password, $user_email, 0 ); if ( !$user_id ) { - die (sprintf(__('ERROR: Couldn’t register you... please contact the webmaster !'), get_settings('admin_email'))); + $errors['user_id'] = sprintf(__('ERROR: Couldn’t register you... please contact the webmaster !'), get_settings('admin_email')); } - $stars = ''; - for ($i = 0; $i < strlen($pass1); $i = $i + 1) { - $stars .= '*'; - } + if(count($errors) == 0) { + $user = new WP_User($user_id); + $user->set_role(get_settings('default_role')); - $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; - $message .= sprintf(__('Password: %s'), $password) . "\r\n"; - $message .= get_settings('siteurl') . "/wp-login.php\r\n"; + do_action('user_register', $user_id); - wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message); - - $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; - $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; - $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; - - @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); + + $stars = ''; + for ($i = 0; $i < strlen($pass1); $i = $i + 1) { + $stars .= '*'; + } + + $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; + $message .= sprintf(__('Password: %s'), $password) . "\r\n"; + $message .= get_settings('siteurl') . "/wp-login.php\r\n"; + + wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message); + + $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; + $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; + $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; + + @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); ?> @@ -81,34 +86,9 @@ case 'register': - - - - - WordPress » <?php _e('Registration Currently Disabled') ?> - - - - - - -
-

-


- -

-
- - - - -

WordPress

- + +
+ +
+

-

-


+

+


A password will be emailed to you.

@@ -150,5 +138,32 @@ default: + + + + WordPress » <?php _e('Registration Currently Disabled') ?> + + + + + + +
+

+


+ +

+
+ + + + + \ No newline at end of file +?> -- cgit