X

Add contact methods to profile, Twitter, Facebook, Flickr

Adding this to the functions.php of your wordpress theme will add Twitter, Facebook, Linkedin and Flickr contact info fields to users profiles. This will also remove aim, yim and jabber fields from user profile pages.


function add_remove_contactmethods( $contactmethods ) {

	$contactmethods['twitter'] = 'Twitter';
	$contactmethods['facebook'] = 'Facebook';
	$contactmethods['linkedin'] = 'Linked In';
	$contactmethods['flickr'] = 'Flickr';

        // this will remove existing contact fields
	unset($contactmethods['aim']);
	unset($contactmethods['yim']);
	unset($contactmethods['jabber']);

	return $contactmethods;
}
add_filter('user_contactmethods','add_remove_contactmethods',10,1);

Comments  Leave a Reply

  1. Easy enough to add these things–anyone figured out a way to REMOVE ones that you don’t want–namely: Website. Neither of the following works:

    unset($contactmethods[‘Website’]);
    unset($contactmethods[‘url’]);

    1. Try ‘user_url’

  2. add_filter(‘user_contactmethods’,’add_remove_contactmethods’,10,1);Is causing issues.

    1. Hi Danni what problems are you encountering?

  3. hi kevin, well .. i’m hooked already with this genius website, a part that i’m not genius at the moment , my simple basic question , okay, we already created alot of fields ..and where the data storage goes at database, already checked table wp_users and..there’s nothing on it .. please advise ..thanks

    1. @google-842df667d8aa359c307fc2f356644c63:disqus  you don’t need to do anything but add this snippet to the functions.php of your wordpress theme.
      You will then need a little bit of code to display it within your theme.

      For the author add,

             get_the_author_meta($curauth->ID);
             echo $curauth->facebook;

  4. Interesting… but how to display this information on the site in the profiles of your members?!

    1. Place this into your template to display the information.

             get_the_author_meta($curauth->ID);
             echo $curauth->facebook;

  5. ????????? ??????? March 18, 2011 at 6:23 am

    wow great .. thanks

    1. No problem, glad you like the snippet,

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!