Skip Navigation

[Resolved] show the User Fields in Admin Columns

This thread is resolved. Here is a description of the problem and solution.

Problem:

Is there a way to show a User Field to the User view as a additional column in the dashboard?

Solution:

There isn't such a built-in feature within Toolset Types plugin.

As a workaround, you can consider custom codes, for example:

https://toolset.com/forums/topic/show-the-user-fields-in-admin-columns/#post-1282799

Relevant Documentation:

https://codex.wordpress.org/Plugin_API/Filter_Reference/manage_users_columns

This support ticket is created 5 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by alexd-6 5 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#1282713

Hey,

i found this solution for my Problem: https://toolset.com/forums/topic/adding-user-field-to-the-admin-users-view-and-ability-to-sort/#post-1282703

But: Yes that is true but it only works with the pro Version of the admin-columns-plugin. - Ist there no way to show the UserFields in AdminColumn of Users?

thx for an answer

alex

#1282799

Dear alex,

Yes, you are right, there isn't such a built-in feature within Toolset Types plugin.

As a workaround, you can consider custom codes, for example:
There are two single line user fields( "test-1" and "test-2"), created with Types plugin, you can try these:

You can add below codes into your them file "functions.php":

function new_modify_user_table( $column ) {
    $column['test-1'] = 'test 1';
    $column['test-2'] = 'test 2';
    return $column;
}
add_filter( 'manage_users_columns', 'new_modify_user_table' );

function new_modify_user_table_row( $val, $column_name, $user_id ) {
    switch ($column_name) {
        case 'test-1' :
            return get_user_meta($user_id, 'wpcf-test-1', true);
        case 'test-2' :
            return get_user_meta($user_id, 'wpcf-test-2', true);
        default:
    }
    return $val;
}
add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );

More help:
https://codex.wordpress.org/Plugin_API/Filter_Reference/manage_users_columns
https://codex.wordpress.org/Function_Reference/get_user_meta

#1283737

My issue is resolved now. Thank you!