I've been frustrated for ages with how WordPress deals with user profile fields. There's a "default" set of contact fields, which has always looked random to me: AIM, Yahoo IM and Jabber / Google Talk. A while back I got frustrated enough to have a look at how this is actually dealt with in the backend of WordPress, and found out that it wouldn't take too much work to fix it into something more decent.
In ticket #10240 I proposed that these user contact fields were filterable, and wrote a patch for it. With some help from Mark Jaquith the patch became clean and nice, and a few weeks back Peter Westwood was so kind as to commit it. So now, starting with 2.9, we'll be able to filter user contact fields.
This works very easily, the code below adds Twitter and removes Yahoo IM, and yes, this is all the code that's needed to do it:
function add_twitter_contactmethod( $contactmethods ) { // Add Twitter $contactmethods['twitter'] = 'Twitter'; // Remove Yahoo IM unset($contactmethods['yim']); return $contactmethods; } add_filter('user_contactmethods','add_twitter_contactmethod',10,1);
How cool is that? Can't wait for 2.9 to come out now, can you? :)






Hi joost,
I was thinking about this exact subject just this week and was delving into forums and plugins to see if there was anything available to meet this requirement. Good news and yes, I want 2.9 already, now, not tomorrow, now. :P
That is awesome... will there be a way (template tag?) to show a user's contact information? For instance, maybe link each comment avatar to that user's twitter if they have one defined? Maybe something like user_contact_link('twitter');
I'm with SeiferTim on this one. This seems more useful if a template tag is available. Then you can provide a super easy solution for integrating your favorite social networks.
Good news!
the_author_metaandget_the_author_metado just that. You could usethe_author_meta('twitter');to display an author's twitter profile, f/i.This is HUGE! I've been following Justin Tadlock's new user role plugin development where this subject came up again. This will open the doors wide open for plugin developers!
Yahhhooooo!
That looks awesome! I wonder if you'll be able to extend $contactmethods to include things like snail mail fields...
AWESOME!! :D I hate editing core-files, so I never edit 'em out, but this is just totally AWESOME!! :D
This seems like a successful attempt to get your social profiles plugin into the wp core :)But it nice for other plugins to be able to set those with a filter.
This really is useful. You tend to come up with this kind of plugins that nobody thinks of, but is useful to half of the WordPress community. Great job Joost!
Awesome - classic example of how open source software improve. Thanks for your contributions and sharing with rest of the community.
Can you also create hidden or fields that can't be edited in the same way?
Any other insights into what we can expect to see in WP 2.9?
Yup, can't wait for WordPress 2.9 now. I never fill up the AIM, Yahoo IM and Jabber / Google Talk but I would love to have Twitter in it.
It's cool. When I will use V. 2.9?