Extend the User Contact Info in WordPress 2.9

WordPress-Christmas-16
Joost de Valk wrote about a month ago a really great article about his idea, to expand the user contact fields (thanks Joost!). In version 2.9 you are able to use this possibility. Here a little example, how you can use this functionality.

First you write your own function in your functions.php of your theme.


This function does nothing more than expand the array $contactmethods with the fields twitter and facebook. The value behind the fields is used as a label for the input fields. You can also remove existing fields, here the field of YAHOO IM:

  // Remove Yahoo IM
  unset($contactmethods['yim']);

WordPress contact info edit screen

This fields can be displayed on the author page.


Follow me on Twitter

Alternatively you can also use the template tag the_author_meta.

the_author_meta('facebook', $current_author->ID)

That’s all behind the 16ht door of our Advent Calendar. 🙂 Have fun expanding your contact fields.


Posted

in

by

Comments

20 responses to “Extend the User Contact Info in WordPress 2.9”

  1. […] Viel Spass beim Erweitern eurer Kontaktfelder. Dieser Beitrag ist das 16. Türchen des WP Engineer Christmas Advent Calendar. […]

  2. Jµ Avatar

    Very usefull ! Thanks guys…

  3. sebastien Avatar
    sebastien

    wp2.9, it’s for when ?

  4. Matt B Avatar

    Well done! I somehow managed to miss the fact that this is for 2.9, not 2.8.6. Small detail, but this looks well worth the improvement.

    Keep it up!

  5. Don Avatar

    This is great, I’ve been wondering if this was possible because I’ve been put in charge of the server for a clan’s website, and adding more contact fields (like tag, and other things) is really nice.

    The downside of this is that I’ll have to wait until 2.9 is released in final because I really don’t want to upgrade them to a beta release…

  6. Dieter Avatar

    Thanks for this useful hint.
    As user of Twitter I´m especially interested in the enhancement with the link to the Twitter account.
    And folks: WP 2.9 is out now! 🙂

  7. Jones Lee Avatar
    Jones Lee

    Nice feature, do you know what function to add extra userdata so I could use it with wp_insert_user to add in more fields like Country, Address, etc

  8. Dragon Blogger Avatar

    Really nice easy way to showcase how to extend the author contact information, I think WordPress should include “Twitter/Facebook” by default now.

  9. […] 5.How To Extend the User Contact Info In WordPress 2.9 […]

  10. Konstantin Avatar

    Awesome! I hated how I had to hardcode everything. I’ll definitely use that in my current project.

  11. Ryan Avatar

    Fantastic article, I have been searching for a few days on how to do this.

    Now, I am using this combined with “Members List” to show users details.

    Thanks!

  12. Ryan Avatar

    This is awesome, thanks so much for sharing.

    I use this in conjunction with:
    http://bavotasan.com/tutorials/how-to-display-an-author-list-with-avatars-in-wordpress/

    To extend my user info, and I show it on whatever pages I want by using conditional statements in my sidebar.

    Thanks again!

  13. Mindaugas Avatar
    Mindaugas

    great tips, but displaying custom field not working, it returns blank value

  14. […] in their profile page using some code on extending user contact information that I learnt via WPEngineer. Very clean and simple, and it adds into a logical place. I am storing this so that registered […]

  15. Sina Saeedi Avatar

    How can I do that if I want to add “Phone Number” and “Birth Date” fields to registration page?

  16. Michael Avatar

    Here is a nice article how to do that: http://planetozh.com/blog/2009/12/how-to-per-user-options-in-wordpress/
    Change it to your needs.

  17. Frank Avatar
    Frank

    What if someone does not include the “http://” in the url they submit (with their twitter or facebook url).

    I’ll get something like this -> http://www.mywebsite.com/www.twitter.com/myname when i click their url on the authorpage.

    Is there an option to automatically include the “http://” ?

  18. Frank Avatar
    Frank

    Oh i got it already

    echo esc_url (does the trick)

    sorry 😉

  19. Frank Avatar
    Frank

    I thought i got the solution but it’s still not working. esc_url only displays the http:// on the authorpage. But the link is still referring to http://www.mywebsite.com/www.twitter.com/myname ;-(

  20. […] all sorts of good stuff, from an interesting discussion on working with WP 2.9 post thumbnails, to extending user info, managing multiple excerpt lengths, and […]