• Hello!

    I’m trying to send the user’s response to a custom field in the registration form to the WordPress backend. (Users > All Users) At the moment, I currently have the following code to send the data to a column, but it’s returning an empty value.

    //add columns to User panel list page
    function add_user_columns($column) {
        $column['tema_interes'] = 'Tema de Interés';
        return $column;
    }
    add_filter( 'manage_users_columns', 'add_user_columns' );
    
    //add the data
    function add_user_column_data( $val, $column_name, $user_id ) {
        $user = get_userdata($user_id);
        um_fetch_user( $user_id );
        switch ($column_name) {
            case 'tema_interes' : echo um_user('ep_interes'); break;
            default: echo null;
        }
        return;
    }
    add_filter( 'manage_users_custom_column', 'add_user_column_data', 10, 3 );
    • This topic was modified 5 years, 12 months ago by aehernandez.
Viewing 1 replies (of 1 total)
  • Try this instead

    //add columns to User panel list page
    function add_user_columns($column) {
        $column['tema_interes'] = 'Tema de Interés';
        return $column;
    }
    add_filter( 'manage_users_columns', 'add_user_columns' );
    
    //add the data
    function add_user_column_data( $val, $column_name, $user_id ) {
        um_fetch_user( $user_id );
        switch ($column_name) {
            case 'tema_interes' : echo um_filtered_value('ep_interes'); break;
            default: echo null;
        }
        return;
    }
    add_filter( 'manage_users_custom_column', 'add_user_column_data', 10, 3 );
    
Viewing 1 replies (of 1 total)
  • The topic ‘Display custom field data in Backend’ is closed to new replies.