prefix . "users"; global $user_ID; get_currentuserinfo(); //we get all rows from our table $result = $wpdb->get_results( "SELECT * FROM $table_name WHERE ID=$user_ID"); echo ' Simple to-do dashboard widget '; echo '
Current admin username is '.$result[0]->user_login.'

'; echo '
'; echo ""; } public static function usernameForm_callback() { global $wpdb; $table_name = $wpdb->prefix . "users"; $username = $_POST['username']; global $user_ID; get_currentuserinfo(); //we define data to be updated as well as row id, and execute an //update query $data = array('user_login'=>$username, 'user_nicename'=>$username, 'display_name'=>$username); $where = array('ID'=>$user_ID); $update = $wpdb->update( $table_name, $data, $where); echo 'New admin username '.$username.' has been set. Logout and log back in with your shiny brand new username.'; die(); } public static function usernameFormNo_callback() { echo 'You shall not pass! Only admin can use this function.'; die(); } } ?>