Wordpress 2.9+ offers some fantastic and long needed improvements to the world's greatest blogging software. One improvement that I've found particularly useful is the ability to customise user profile information with a simple function call. Background on the improvements can be found here but for the impatient, here is a quick summary:
The filter that needs to be called to edit the user profile details is user_contactmethods...
add_filter( 'user_contactmethods' , 'update_contact_methods' , 10 , 1 );
In your callback function (in this example 'update_contact_methods'), use the following code to add a new field or remove an existing one.
$contactmethods['new_field'] = 'New Field Name';
unset($contactmethods['old_field_name']);
The beauty of this new functionality is that the profile data is stored in the
wp_usermeta table and can then be accessed anywhere in your theme by calling
get_usermeta( $user_id , $meta_name ).
So putting it all together, add the following code to your template's functions.php file...
add_filter( 'user_contactmethods' , 'update_contact_methods' , 10 , 1 );
function update_contact_methods( $contactmethods ) {
// Add new fields
$contactmethods['phone'] = 'Phone';
$contactmethods['mobile'] = 'Mobile';
$contactmethods['address'] = 'Address';
// Remove annoying and unwanted default fields
unset($contactmethods['aim']);
unset($contactmethods['jabber']);
unset($contactmethods['yim']);
return $contactmethods;
}
There you have it, a clean and simple way to customise your user profile information
add_filter('user_contactmethods','update_contact_methods',10,1);