This is an old version of this answer!
Return to the current answerHere's a basic working example plugin, that works in WordPress 2.8 and above.
Just add a folder 'user-column' to the plugins folder, put a file 'user-column.php' into this folder and paste the following code into the file:
This adds a column "Age" to the users liste page displaying a custom user meta key 'age'.
Alter as you like. :)
Just add a folder 'user-column' to the plugins folder, put a file 'user-column.php' into this folder and paste the following code into the file:
<?php
/*
Plugin Name: Custom User Column
Version: 0.7
Plugin URI: http://www.wpquestions.com/question/show/id/74
Description: <strong>WordPress 2.8+ only.</strong> Display Custom User Fields on Edit Users Screen
Author: Oliver Schlöbe
Author URI: http://wpseek.com/
*/
function imel_column_userfield( $defaults ) {
$defaults['imel-usercolumn-userfield'] = __('Age', 'user-column');
return $defaults;
}
function imel_custom_column_userfield($value, $column_name, $id) {
if( $column_name == 'imel-usercolumn-userfield' ) {
return get_usermeta($id, 'age');
}
}
add_action('manage_users_custom_column', 'imel_custom_column_userfield', 15, 3);
add_filter('manage_users_columns', 'imel_column_userfield', 15, 1);
?>This adds a column "Age" to the users liste page displaying a custom user meta key 'age'.
Alter as you like. :)
Oliver Schlöbe | 12/21/09 at 8:41am





