• Resolved rhonn

    (@rhonn)


    Hi, I’ve been using your plugin for a month now and it’s been working great.

    I’ve added a couple of custom fields to the user registration form (Phone Number and Company Name)

    Is there a way these added fields can appear as new columns in the Users section of the WP Dashboard?

    Do you have an extension or plugin to achieve this?

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Towhid

    (@cryptex_vinci)

    Hi @rhonn

    You can use this snippet to display UM user content to WordPress user dashboard or panel.

    Make sure to Change the 2nd paramenter with your desired UM meta key.
    https://gist.github.com/cryptexvinci/467faf7211d3055d59862eb87653a2cd

    Thanks

    Thread Starter rhonn

    (@rhonn)

    Hi Asif

    This worked out great! Thank you very much.

    Now if I want to add another column with another parameter, I just duplicate this snippet with the new parameter?

    Or can I integrate the second parameter into the original snippet?

    Thanks again!

    ***EDIT****

    Ok, I modified it this way, and it’s working I just wanted to know if there’s an more efficient way to write it?

    add_filter( 'manage_users_columns', 'um_custom_add_new_user_column' );
      
    function um_custom_add_new_user_column( $columns ) {
        $columns['um_phone'] = 'Phone Number';
        $columns['um_company'] = 'Company';
        return $columns;
    }
      
    add_filter( 'manage_users_custom_column', 'um_custom_add_new_user_column_content', 10, 3 );
      
    function um_custom_add_new_user_column_content( $content, $column, $user_id ) {
        // Change the 2nd parameter with your desired UM Meta Key
        if ( 'um_phone' === $column ) {
            $content = get_user_meta( $user_id, 'phone_number', true );
        }
        
        if ( 'um_company' === $column ) {
            $content = get_user_meta( $user_id, 'company_name', true );
        }
        return $content;
    }

    Thanks again!

    • This reply was modified 4 years, 1 month ago by rhonn.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @rhonn

    Sorry for the late response.

    Yes, that’s how I would add the custom column filters.

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom fields in User Registration to appear as columns in Users Dashboard’ is closed to new replies.