Forked from strangerstudios/my_pmpro_manage_users_columns.php
Last active
September 22, 2018 15:03
-
-
Save itsjusteileen/d931ba58e9c2fb3536156366058b3e23 to your computer and use it in GitHub Desktop.
Add extra column for city and state to Members List table for user field added via PMPro City and State Add On
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 'City' Column to Users List Header | |
function pmpro_manage_users_columns($columns) { | |
$columns['city'] = 'City'; | |
return $columns; | |
} | |
add_filter('manage_users_columns', 'pmpro_manage_users_columns'); | |
//Add 'City' Column to Users List Rows | |
function pmpro_manage_users_custom_column($value, $column_name, $user_id) { | |
$theuser = get_userdata( $user_id ); | |
if ( 'city' == $column_name ) | |
return $theuser->city; | |
return $value; | |
} | |
add_action('manage_users_custom_column', '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