* @copyright Yes, Open source, WebsiteFreelancers.nl * @version v 1.0 26-09-2009 Ramon$ */ global $wpdb,$current_user; $message = null; $showMsg = 'none'; /** * If submiting the form */ if (count($_POST)) { $oldName = htmlspecialchars(trim($_POST['plugin_admin_renamer-oldname'.intval($_GET['user_id'])])); $newName = htmlspecialchars(trim($_POST['plugin_admin_renamer-newname'.intval($_GET['user_id'])])); if(empty($newName)) { $message = $oldName. ' NOT changed, new name was empty!'; $showMsg = 'block'; } else { $user_query = "UPDATE $wpdb->users SET user_login = '{$newName}' WHERE {$wpdb->users}.ID = ".intval($_GET['user_id'])." LIMIT 1"; $wpdb->get_results( $user_query ); $message = 'Changed '.$oldName. ' into '.$newName; $showMsg = 'block'; } } ?> Untitled Document
Admin renamer - Showing all admin accounts
users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$wpdb->prefix}capabilities' AND (ID = 1 OR user_login = 'admin' OR meta_value LIKE('%administrator%')) ORDER BY ID ASC"; $users = $wpdb->get_results( $user_query ); foreach($users AS $row) { ?>

Current admin username: user_login; ?> ID == 1) { echo '
Warning: This is the MAIN admin or site owner!'; } if($row->ID == $current_user->ID) { echo '
Warning: This is you! After changing your login name you might need to log in again!'; } ?>