Yoast: Building Page.ly Part4: Scalable and Fast Managed WordPress Hosting | Page.ly Blog http://t.co/ba32Hemn
![]()
User Contact Fields in WordPress 2.9
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? :)





by Justin Parks on 11 September, 2009 at 19:47
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
by SeiferTim on 11 September, 2009 at 19:51
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');
by Branden on 4 October, 2009 at 12:42
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.
by Joost de Valk on 4 October, 2009 at 18:43
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.by Adam W. Warner on 11 September, 2009 at 19:55
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!
by Dennis Whiteman on 11 September, 2009 at 20:05
That looks awesome! I wonder if you'll be able to extend $contactmethods to include things like snail mail fields...
by Hiranthi on 11 September, 2009 at 20:29
AWESOME!! :D I hate editing core-files, so I never edit 'em out, but this is just totally AWESOME!! :D
by Mihai Secasiu on 11 September, 2009 at 20:34
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.
by Coen Jacobs on 11 September, 2009 at 22:10
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!
by Saud Khan on 11 September, 2009 at 23:53
Awesome - classic example of how open source software improve. Thanks for your contributions and sharing with rest of the community.
by Andy Beard on 12 September, 2009 at 02:06
Can you also create hidden or fields that can't be edited in the same way?
by Maskil on 13 September, 2009 at 16:16
Any other insights into what we can expect to see in WP 2.9?
by Sarah on 14 September, 2009 at 15:24
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.
by Jugjarun Wachiramethin on 18 September, 2009 at 14:10
It's cool. When I will use V. 2.9?
Pingback: Wordpress 2.9 Coming Soon – Features, Tips and Screenshots
Pingback: Wordpress 2.9 Coming Soon – Features, Tips and Screenshots | Windy Blog