WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a way to create a menu page with a list of all users for administrative purposes. The list will be used by users that don't have permission or acceses to the "Users" menu page. The page need to have the User ID, Name, Registration Date, Nickname, User Level and User Role for each user

Any idea how to achieve this ? Any reference docs or tutorial is welcome also.

share|improve this question
up vote 1 down vote accepted

As a plugin all that I can give to you is this.

Plugin Name: Users Table
Plugin URI: http://www.exe.ie
Description: A list of all available users with their ID, Name, Registration Date, Nickname, User Level and User Role
Version: 1.0
Author: Daniel Conde
Author URI: http://www.exe.ie
License: GPL

add_action('admin_menu', 'my_user_table_menu');

function my_user_table_menu() {
    add_menu_page('Users Table', 'Users Table', '0', 'users_table', 'users_table');

function users_table() {
        global $wpdb; ?>
      <h3>Users Table</h3>
      <table class="wp-list-table widefat fixed users">
            <th><b>User ID</b></th>
            <th><b>User Level</b></th>
            <th><b>User Role</b></th>
        <tbody id="the-list" class="list:user"><?php 
          $wp_user_search = $wpdb->get_results("SELECT ID, display_name FROM $wpdb->users ORDER BY ID");
          foreach ( $wp_user_search as $userid ) {
            $user_id = (int) $userid->ID;
            $user_info = get_userdata($user_id);
            $formid = $user_info->formid;
            $user = new WP_User( $user_id );
            echo '<tr id="user-'.$user_id.'" class="alternate">';
            echo '<th>' . $user_id . '</th>';
            echo '<th>' . $user_info->display_name . '</th>';
            echo '<th>' . $user_info->user_registered . '</th>';
            echo '<th>' . $user_info->nickname . '</th>';
            echo '<th>' . $user_info->user_level . '</th>';
            echo '<th>'; if ( !empty( $user->roles ) && is_array( $user->roles ) ) { foreach ( $user->roles as $role ) echo $role; } echo '</th>';
            echo '</tr>';
          } ?>
            <th><b>User ID</b></th>
            <th><b>User Level</b></th>
            <th><b>User Role</b></th>
  } ?>

Not a beauty, but it does the job.

Copy and save as users-table.php , upload to your plugins folder and activate

share|improve this answer
+1 but for tables I would use the wp-list-table class – Stephen Harris May 9 '12 at 18:45

Just use wp_list_authors() and extend the author archive – usually author.php.
Depending on the capability you show various author details. No need for a plugin or difficult hacks. :)

share|improve this answer
Well I think in this case you are wrong, Some how I will end up using a plugin for the whole task as it simplifies things rather that modiffy the author.php – user1068410 May 9 '12 at 18:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.