Created
February 29, 2016 12:46
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/