Changeset 2704 for trunk/wp-register.php
- Timestamp:
- 07/12/2005 03:53:13 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-register.php
r2702 r2704 15 15 $user_login = sanitize_user( $_POST['user_login'] ); 16 16 $user_email = $_POST['user_email']; 17 18 $errors = array(); 17 19 18 20 if ( $user_login == '' ) 19 die (__('<strong>ERROR</strong>: Please enter a username.'));21 $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.'); 20 22 21 23 /* checking e-mail address */ 22 24 if ($user_email == '') { 23 die (__('<strong>ERROR</strong>: Please type your e-mail address.'));25 $errors['user_email'] = __('<strong>ERROR</strong>: Please type your e-mail address.'); 24 26 } else if (!is_email($user_email)) { 25 die (__('<strong>ERROR</strong>: The email address isn’t correct.'));27 $errors['user_email'] = __('<strong>ERROR</strong>: The email address isn’t correct.'); 26 28 } 27 29 28 29 die (__('<strong>ERROR</strong>: This username is already registered, please choose another one.'));30 if ( username_exists( $user_login ) ) 31 $errors['user_login'] = __('<strong>ERROR</strong>: This username is already registered, please choose another one.'); 30 32 31 $user_level = get_settings('new_users_can_blog');32 33 $password = substr( md5( uniqid( microtime() ) ), 0, 7); 33 34 34 $user_id = create_user( $user_login, $password, $user_email, $user_level ); 35 36 do_action('user_register', $user_id); 37 35 $user_id = create_user( $user_login, $password, $user_email, 0 ); 38 36 if ( !$user_id ) { 39 die (sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_settings('admin_email')));37 $errors['user_id'] = sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_settings('admin_email')); 40 38 } 41 39 42 $stars = ''; 43 for ($i = 0; $i < strlen($pass1); $i = $i + 1) { 44 $stars .= '*'; 45 } 40 if(count($errors) == 0) { 41 $user = new WP_User($user_id); 42 $user->set_role(get_settings('default_role')); 46 43 47 $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; 48 $message .= sprintf(__('Password: %s'), $password) . "\r\n"; 49 $message .= get_settings('siteurl') . "/wp-login.php\r\n"; 44 do_action('user_register', $user_id); 50 45 51 wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message); 52 53 $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; 54 $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 55 $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; 56 57 @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); 46 47 $stars = ''; 48 for ($i = 0; $i < strlen($pass1); $i = $i + 1) { 49 $stars .= '*'; 50 } 51 52 $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; 53 $message .= sprintf(__('Password: %s'), $password) . "\r\n"; 54 $message .= get_settings('siteurl') . "/wp-login.php\r\n"; 55 56 wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message); 57 58 $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; 59 $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 60 $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; 61 62 @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); 58 63 59 64 ?> … … 82 87 </html> 83 88 89 <?php 90 break; 91 } 92 93 default: 94 95 ?> 96 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 97 <html xmlns="http://www.w3.org/1999/xhtml"> 98 <head> 99 <title>WordPress » <?php _e('Registration Form') ?></title> 100 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> 101 <link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" /> 102 <style type="text/css"> 103 #user_email, #user_login, #submit { 104 font-size: 1.7em; 105 } 106 </style> 107 </head> 108 109 <body> 110 <div id="login"> 111 <h1><a href="http://wordpress.org/">WordPress</a></h1> 112 <h2><?php _e('Register for this blog') ?></h2> 113 <?php if ( isset($errors) ) : ?> 114 <div class="error"> 115 <ul> 84 116 <?php 117 foreach($errors as $error) echo "<li>$error</li>"; 118 ?> 119 </ul> 120 </div> 121 <?php endif; ?> 122 <form method="post" action="wp-register.php" id="registerform"> 123 <p><input type="hidden" name="action" value="register" /> 124 <label for="user_login"><?php _e('Username:') ?></label><br /> <input type="text" name="user_login" id="user_login" size="20" maxlength="20" value="<?php echo $user_login; ?>" /><br /></p> 125 <p><label for="user_email"><?php _e('E-mail:') ?></label><br /> <input type="text" name="user_email" id="user_email" size="25" maxlength="100" value="<?php echo $user_email; ?>" /></p> 126 <p>A password will be emailed to you.</p> 127 <p class="submit"><input type="submit" value="<?php _e('Register') ?> »" id="submit" name="submit" /></p> 128 </form> 129 <ul> 130 <li><a href="<?php bloginfo('home'); ?>" title="<?php _e('Are you lost?') ?>">« <?php _e('Back to blog') ?></a></li> 131 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Login') ?></a></li> 132 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li> 133 </ul> 134 </div> 135 136 </body> 137 </html> 138 <?php 139 85 140 break; 86 141 … … 111 166 break; 112 167 113 default:114 115 ?>116 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">117 <html xmlns="http://www.w3.org/1999/xhtml">118 <head>119 <title>WordPress » <?php _e('Registration Form') ?></title>120 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />121 <link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" />122 <style type="text/css">123 #user_email, #user_login, #submit {124 font-size: 1.7em;125 }126 </style>127 </head>128 129 <body>130 <div id="login">131 <h1><a href="http://wordpress.org/">WordPress</a></h1>132 <h2><?php _e('Register for this blog') ?></h2>133 134 <form method="post" action="wp-register.php" id="registerform">135 <p><input type="hidden" name="action" value="register" />136 <label for="user_login"><?php _e('Username:') ?></label><br /> <input type="text" name="user_login" id="user_login" size="20" maxlength="20" /><br /></p>137 <p><label for="user_email"><?php _e('E-mail:') ?></label><br /> <input type="text" name="user_email" id="user_email" size="25" maxlength="100" /></p>138 <p>A password will be emailed to you.</p>139 <p class="submit"><input type="submit" value="<?php _e('Register') ?> »" id="submit" name="submit" /></p>140 </form>141 <ul>142 <li><a href="<?php bloginfo('home'); ?>" title="<?php _e('Are you lost?') ?>">« <?php _e('Back to blog') ?></a></li>143 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Login') ?></a></li>144 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li>145 </ul>146 </div>147 148 </body>149 </html>150 <?php151 152 break;153 168 } 154 169 ?>
Note: See TracChangeset
for help on using the changeset viewer.