Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author donmik

    (@atallos)

    You can try this: https://tareq.wedevs.com/2011/07/add-your-custom-columns-to-wordpress-admin-panel-tables/

    <?php
    function test_modify_user_table( $column ) {
        $column['name of the column'] = 'display name of the column';
    
        return $column;
    }
    
    add_filter( 'manage_users_columns', 'test_modify_user_table' );
    
    function test_modify_user_table_row( $val, $column_name, $user_id ) {
        switch ($column_name) {
            case 'name of the column' :
                return xprofile_get_field_data('name of the field', $user_id);
                break;
    
            default:
        }
    
        return $return;
    }
    
    add_filter( 'manage_users_custom_column', 'test_modify_user_table_row', 10, 3 );

    This code must work, you must change the following:
    “name of the column” => The name of the column.
    “display name of the column” => The name of the column you want to be displayed.
    “name of the field” => The name of the xprofile field you want to display the value.

    Thread Starter devpaq

    (@devpaq)

    I ended up using the plugin https://www.ads-software.com/plugins/buddypress-profile-view-from-admin/ which has a link to the profile details – but your code would be much more helpful since it will be on the same screen. I will try it out later and let you know how it goes.
    Thanks!

    @domnik, your code works perfectly, would make it sortable?

    Plugin Author donmik

    (@atallos)

    Make it sortable will be more complicated, you probably have to use filters to modify query…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Displaying profile fields in admin user listing’ is closed to new replies.