Was working on this, thought to blog.

Sometimes it's needed to add extra column on user table to show extra property file a custom meta field or something like this. Let's say you want to list a column called "Customer Since" on user table which will display the registration date of your user.

Okay we'll do it now.

To achieve this we will have to use to action hook called "manage_users_columns" and "manage_users_custom_column"

First will have to add the extra column on the table.

function register_custom_user_column($columns) {
    $columns['customer_since'] = 'Customer Since';
    return $columns;

Now generate the value

function register_custom_user_column_view($value, $column_name, $user_id) {
    $user_info = get_userdata( $user_id );
    if($column_name == 'customer_since') return $user_info->user_registered;
    return $value;


Finally hook them

add_action('manage_users_columns', 'register_custom_user_column');
add_action('manage_users_custom_column', 'register_custom_user_column_view', 10, 3);

Aaand, that's it.

What's on your mind?


Finn commented 3 days ago

excellent issues altogether, you simply gained a new reader. What could you suggest in regards to your put up that you just made some days ago? Any positive?

minkys lash extensions training commented 3 days ago

Great items from you, man. I have take note your stuff previous to and you're simply extremely fantastic. I really like what you've acquired here, certainly like what you are saying and the best way in which you assert it. You are making it entertaining and you continue to care for to stay it wise. I cant wait to learn much more from you.

That is really a terrific site.

madden mobile coin seller commented about 19 hours ago

At this time it appears like Drupal is the top blogging platform available right now. (from what I've read) Is that what you are using on your blog?

http://arcmos.com commented 3 days ago

If some one needs expert view about blogging and site-building after that i suggest him/her to pay a visit this webpage, Keep up the nice job.

csgo skins for sale paypal commented about 17 hours ago

I don't even know how I stopped up here, however I assumed this submit was great. I don't recognise who you're however certainly you're going to a well-known blogger should you aren't already.


madden 17 coins free commented 3 days ago

Appreciate the recommendation. Will try it out.

modmanpaul commented almost 2 years ago

perfect thank you. I used this to display a custom user meta value I create on registration. can you tell me how to make this new column searchable? i don't need to sort by it but when I search for the value (a number) it says no users found