How to Add user_registered Column in Authors & Users Page on wp-admin of WordPress

Once upon a time, I needed to monitor when did my users register their account in one of my WordPress website. It meant that I needed to get the value from user_registered field in the users table, and then displaying it in Authors & Users page on wp-admin of WordPress. I have searched for the plugin regarding this, but I found nothing. Actually, I wanted to create the plugin to implement it. Unfortunately, I still have no idea how to do this, since I am not expert to create the plugin (probably someday I can do it). So I decided to edit the core file of WordPress. First of all, I opened the users.php file that located in wp-admin sub directory. After investigating this file for a few minutes, then I found the code regarding how to display the users list in template.php based on the code or function call user_row and get_column_headers. This template.php file located in /wp-admin/includes/ sub directory. So, here is the modification I made.

Open your /wp-admin/includes/template.php file, and find this code:

899
900
901
902
903
904
905
906
907
		case 'users':
			$_wp_column_headers[$page] = array(
				'cb' => '<input type="checkbox" />',
				'username' => __('Username'),
				'name' => __('Name'),
				'email' => __('E-mail'),
				'role' => __('Role'),
				'posts' => __('Posts')
			);

then replace with this following code:

899
900
901
902
903
904
905
906
907
908
		case 'users':
			$_wp_column_headers[$page] = array(
				'cb' => '<input type="checkbox" />',
				'username' => __('Username'),
				'name' => __('Name'),
				'email' => __('E-mail'),
				'role' => __('Role'),
				'posts' => __('Posts'),
				'user_registered' => __('Registered Date') // added by Masino Sinaga, January 13, 2010
			);

Find again this code:

1985
1986
1987
1988
1989
			default:
				$r .= "<td $attributes>";
				$r .= apply_filters('manage_users_custom_column', '', $column_name, $user_object->ID);
				$r .= "</td>";
		}

before the first line of that code, please insert this following code:

1984
1985
1986
			case 'user_registered':  // added by Masino Sinaga, January 13, 2010
				$r .= "<td $attributes>$user_object->user_registered</td>";
				break;

That’s all. Now, go to your wp-admin of your WordPress website, then see the Authors & Users page under the Users menu. You should see now the new column at the right most of the list named Registered Date. I had tested and it worked like a charm.

Please do not hesitate to leave your comment if you have a new idea how to implement this using the plugin in WordPress.

Hopefully this will help someone else out there.

Updated on October 5, 2011: That article above I wrote when the version of WordPress was under 3.0. I found a great plugin today in order to do the same function above. It is Recently Registered.

Share

1,840 viewsPrint This Post Print This Post

Comments

  1. Luca says:

    Thanks for the solution.

    Do you think this modification of the core will be interferee with other plugins, or with the wordpress core itself?

  2. I don’t think so. As long as the other plugins does not have the same purpose with this modification, they will not be interferee with this modification. Let me know if you find the plugin related to this modification.

    Please note that if you upgrade your WordPress to the new version, then you have to apply this modification to the related files as WordPress will overwrite the change you made to the core files. Don’t forget to backup your files before doing that. Thanks.

  3. Roseann says:

    This worked like a charm. Do you know of any way to enable the sorting of columns?

  4. John Kolbert says:

    This can all be done with out modifying the core files. WordPress has numerous actions and filters just for this. I’ve done things similar to this on the post/page tables all from a plugin I created for a client. I would hesitate A LOT before editing core files, as you’ll loose them in the upgrades.

  5. @Roseann

    I will try to find out how to do that. Thanks for the idea.

  6. @John Kolbert

    I knew about how to add the new column on post/page list. Unfortunately, I still have no idea how to do the similar things for users list page, since the code structure for displaying the users list look like completely different with the code structure for displaying the post/page list. Should you find out the way, please let me know. Thanks.

Speak Your Mind

*


*