data; } if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permission to edit this user.'); /* checking the nickname has been typed */ if (empty($_POST["new_nickname"])) { $errors['nickname'] = __("ERROR: please enter your nickname (can be the same as your username)"); } $new_user_login = wp_specialchars($_POST['new_user_login']); $pass1 = $_POST['pass1']; $pass2 = $_POST['pass2']; do_action('check_passwords', array($new_user_login, &$pass1, &$pass2)); if ( '' == $pass1 ) { if ( '' != $pass2 ) $errors['pass'] = __("ERROR: you typed your new password only once."); $updatepassword = ''; } else { if ( '' == $pass2) $errors['pass'] = __("ERROR: you typed your new password only once."); if ( $pass1 != $pass2 ) $errors['pass'] = __("ERROR: you typed two different passwords."); $new_pass = $pass1; $updatepassword = "user_pass=MD5('$new_pass'), "; } $edituser->user_login = wp_specialchars($_POST['new_user_login']); $edituser->user_nicename = sanitize_title($new_nickname, $user_id); $edituser->user_email = wp_specialchars($_POST['new_email']); $edituser->user_url = wp_specialchars($_POST['new_url']); $edituser->user_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $edituser->user_url) ? $edituser->user_url : 'http://' . $edituser->user_url; $edituser->display_name = wp_specialchars($_POST['display_name']); $edituser->first_name = wp_specialchars($_POST['new_firstname']); $edituser->last_name = wp_specialchars($_POST['new_lastname']); $edituser->nickname = $_POST['new_nickname']; $edituser->icq = wp_specialchars($_POST['new_icq']); $edituser->aim = wp_specialchars($_POST['new_aim']); $edituser->msn = wp_specialchars($_POST['new_msn']); $edituser->yim = wp_specialchars($_POST['new_yim']); $edituser->description = $_POST['new_description']; if(count($errors) == 0) { $result = $wpdb->query("UPDATE $wpdb->users SET user_login = '$edituser->user_login', $updatepassword user_email='$edituser->user_email', user_url='$edituser->user_url', user_nicename = '$edituser->user_nicename', display_name = '$edituser->display_name' WHERE ID = '$user_id'"); update_usermeta( $user_id, 'first_name', $edituser->firstname ); update_usermeta( $user_id, 'last_name', $edituser->lastname ); update_usermeta( $user_id, 'nickname', $edituser->nickname ); update_usermeta( $user_id, 'description', $edituser->description ); update_usermeta( $user_id, 'icq', $edituser->icq ); update_usermeta( $user_id, 'aim', $edituser->aim ); update_usermeta( $user_id, 'msn', $edituser->msn ); update_usermeta( $user_id, 'yim', $edituser->yim ); $wp_user->set_role($_POST['new_role']); header("Location: user-edit.php?user_id=$user_id&updated=true"); } else { $wp_user->roles = array($_POST['new_role'] => true); } default: include ('admin-header.php'); if(empty($wp_user)) { $wp_user = new WP_User($user_id); $edituser = &$wp_user->data; } if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permission to edit this user.'); ?>