Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created February 29, 2016 12:46
Show Gist options
  • Save strangerstudios/44c25c5299a23ab08a40 to your computer and use it in GitHub Desktop.
Save strangerstudios/44c25c5299a23ab08a40 to your computer and use it in GitHub Desktop.
Add extra column to Users List for user field added via Register Helper
//Add 'Company' Column to Users List Header
function my_pmpro_manage_users_columns($columns) {
$columns['company'] = 'Company';
return $columns;
}
add_filter('manage_users_columns', 'my_pmpro_manage_users_columns');
//Add 'Company' Column to Users List Rows
function my_pmpro_manage_users_custom_column($value, $column_name, $user_id) {
$theuser = get_userdata( $user_id );
if ( 'company' == $column_name )
return $theuser->company;
return $value;
}
add_action('manage_users_custom_column', 'my_pmpro_manage_users_custom_column', 10, 3);
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Add a Custom Column to the Members List and All Users Admin Pages" at Paid Memberships Pro here: https://www.paidmembershipspro.com/add-custom-column-members-list-users-admin-pages/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment