set_role($_POST['new_role']); } header('Location: users.php?update=promote'); break; case 'dodelete': check_admin_referer(); if (empty($_POST['users'])) { header('Location: users.php'); } if ( !current_user_can('edit_users') ) die(__('You can’t delete users.')); $userids = $_POST['users']; foreach($userids as $id) { switch($_POST['delete_option']) { case 'delete': wp_delete_user($id); break; case 'reassign': wp_delete_user($id, $_POST['reassign_user']); break; } } header('Location: users.php?update=del'); break; case 'delete': check_admin_referer(); if (empty($_POST['users'])) { header('Location: users.php'); } if ( !current_user_can('edit_users') ) $error['edit_users'] = __('You can’t delete users.'); $userids = $_POST['users']; include ('admin-header.php'); ?>
ERROR: Please enter a username.'); /* checking the password has been typed twice */ do_action('check_passwords', array($new_user_login, &$new_pass1, &$new_pass2)); if ($new_pass1 == '' || $new_pass2 == '') $errors['pass'] = __('ERROR: Please enter your password twice.'); /* checking the password has been typed twice the same */ if ($new_pass1 != $new_pass2) $errors['pass'] = __('ERROR: Please type the same password in the two password fields.'); $new_user_nickname = $new_user_login; if ( username_exists( $new_user_login ) ) $errors['pass'] = __('ERROR: This username is already registered, please choose another one.'); /* checking e-mail address */ if (empty($new_user_email)) { $errors['user_email'] = __("ERROR: please type an e-mail address"); } else if (!is_email($new_user_email)) { $errors['user_email'] = __("ERROR: the email address isn't correct"); } if(count($errors) == 0) { $user_ID = create_user( $new_user_login, $new_pass1, $new_user_email, 0 ); update_usermeta( $user_ID, 'first_name', $new_user_firstname); update_usermeta( $user_ID, 'last_name', $new_user_lastname); update_usermeta( $user_ID, 'first_name', $new_user_firstname); $user = new WP_User($user_ID); $user->set_role(get_settings('default_role')); $stars = ''; for ($i = 0; $i < strlen($pass1); $i = $i + 1) $stars .= '*'; $user_login = stripslashes($new_user_login); $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $new_user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s'), $new_user_email) . "\r\n"; @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); do_action('user_register', $user_id); header('Location: users.php?update=add'); die(); } default: include ('admin-header.php'); $userids = $wpdb->get_col("SELECT ID FROM $wpdb->users;"); foreach($userids as $userid) { $tmp_user = new WP_User($userid); $roles = $tmp_user->roles; $role = $roles[0]; $roleclasses[$role][$tmp_user->data->user_login] = $tmp_user; } ?>