1

On the user main page in the screen options, you have some choices for displaying user information e.g.. e-mail, role, posts etc..

Is there a way to be able to display the user's unique ID?

4
  • Exactly where do you see this "user tracking" stuff? Was this added by a plugin perhaps?
    – s_ha_dum
    May 30, 2013 at 17:04
  • At the top of the screen you have 'Screen Options' It allows you to show Role, e-mail, posts etc.. I want to add User ID to the list. Not added by any plugin, default Wordpress functionality.
    – Romes
    May 30, 2013 at 17:12
  • Ahh... you aren't talking about tracking at all. Just showing or hiding those meta boxes.
    – s_ha_dum
    May 30, 2013 at 17:14
  • I guess you are right. I've updated my question.
    – Romes
    May 30, 2013 at 17:15

1 Answer 1

4

You need to use the filter 'manage_' . $screen->id . '_columns' to add a column and manage_users_custom_column to display its value.

add_filter( 'manage_users_columns', 'column_register_wpse_101322' );
add_filter( 'manage_users_custom_column', 'column_display_wpse_101322', 10, 3 );

function column_register_wpse_101322( $columns ) 
{
    $columns['uid'] = 'ID';
    return $columns;
}

function column_display_wpse_101322( $empty, $column_name, $user_id ) 
{
    if ( 'uid' != $column_name )
        return $empty;

    return "<strong>$user_id</strong>";
}

With this, the ID will show up in the Screen Options as well.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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