Changeset 2872 for trunk/wp-admin/users.php
- Timestamp:
- 09/14/2005 12:03:02 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/users.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/users.php
r2847 r2872 111 111 case 'adduser': 112 112 check_admin_referer(); 113 114 $new_user_login = wp_specialchars(trim($_POST['user_login'])); 115 $new_pass1 = $_POST['pass1']; 116 $new_pass2 = $_POST['pass2']; 117 $new_user_email = wp_specialchars(trim($_POST['email'])); 118 $new_user_firstname = wp_specialchars(trim($_POST['firstname'])); 119 $new_user_lastname = wp_specialchars(trim($_POST['lastname'])); 120 $new_user_uri = wp_specialchars(trim($_POST['uri'])); 121 122 $errors = array(); 123 124 /* checking that username has been typed */ 125 if ($new_user_login == '') 126 $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.'); 127 128 /* checking the password has been typed twice */ 129 do_action('check_passwords', array($new_user_login, &$new_pass1, &$new_pass2)); 130 if ($new_pass1 == '' || $new_pass2 == '') 131 $errors['pass'] = __('<strong>ERROR</strong>: Please enter your password twice.'); 132 133 /* checking the password has been typed twice the same */ 134 if ($new_pass1 != $new_pass2) 135 $errors['pass'] = __('<strong>ERROR</strong>: Please type the same password in the two password fields.'); 136 137 $new_user_nickname = $new_user_login; 138 139 if ( username_exists( $new_user_login ) ) 140 $errors['pass'] = __('<strong>ERROR</strong>: This username is already registered, please choose another one.'); 141 142 /* checking e-mail address */ 143 if (empty($new_user_email)) { 144 $errors['user_email'] = __("<strong>ERROR</strong>: please type an e-mail address"); 145 } else if (!is_email($new_user_email)) { 146 $errors['user_email'] = __("<strong>ERROR</strong>: the email address isn't correct"); 147 } 148 149 if(count($errors) == 0) { 150 $user_ID = create_user( $new_user_login, $new_pass1, $new_user_email, 0 ); 151 152 update_usermeta( $user_ID, 'first_name', $new_user_firstname); 153 update_usermeta( $user_ID, 'last_name', $new_user_lastname); 154 update_usermeta( $user_ID, 'first_name', $new_user_firstname); 155 156 $user = new WP_User($user_ID); 157 $user->set_role(get_settings('default_role')); 158 159 $stars = ''; 160 for ($i = 0; $i < strlen($pass1); $i = $i + 1) 161 $stars .= '*'; 162 163 $user_login = stripslashes($new_user_login); 164 $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; 165 $message .= sprintf(__('Username: %s'), $new_user_login) . "\r\n\r\n"; 166 $message .= sprintf(__('E-mail: %s'), $new_user_email) . "\r\n"; 167 168 @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); 169 170 do_action('user_register', $user_id); 171 113 114 $errors = add_user(); 115 116 if(count($errors) == 0) { 172 117 header('Location: users.php?update=add'); 173 118 die(); … … 311 256 <tr> 312 257 <th scope="row"><?php _e('First Name') ?> </th> 313 <td><input name="first name" type="text" id="firstname" value="<?php echo $new_user_firstname; ?>" /></td>258 <td><input name="first_name" type="text" id="first_name" value="<?php echo $new_user_firstname; ?>" /></td> 314 259 </tr> 315 260 <tr> 316 261 <th scope="row"><?php _e('Last Name') ?> </th> 317 <td><input name="last name" type="text" id="lastname" value="<?php echo $new_user_lastname; ?>" /></td>262 <td><input name="last_name" type="text" id="last_name" value="<?php echo $new_user_lastname; ?>" /></td> 318 263 </tr> 319 264 <tr> … … 323 268 <tr> 324 269 <th scope="row"><?php _e('Website') ?></th> 325 <td><input name="ur i" type="text" id="uri" value="<?php echo $new_user_uri; ?>" /></td>270 <td><input name="url" type="text" id="url" value="<?php echo $new_user_uri; ?>" /></td> 326 271 </tr> 327 272 <?php
Note: See TracChangeset
for help on using the changeset viewer.