• Skip to primary navigation
  • Skip to main content
  • Skip to footer
  • Books
    • Content Strategy for WordPress (2015)
    • WordPress for Web Developers (2013)
    • Beginning WordPress 3 (2010)
  • Blog
    • Content Modeling for WordPress
    • WordPress Hidden Gems
    • Web Design
  • Work
    • Presentations and Interviews
    • on GitHub →
    • MLIS Class Projects (2019-2022)
    • Portfolio (2002-2019)
    • WordPress Plugins

Stephanie Leary

Writer, Front End Developer, former WordPress consultant

  • About
    • Press Kit
    • Presentations and Interviews
  • Contact Me

Creating a user directory, part 1: changing user contact fields

January 26, 2010 Stephanie Leary 1 Comment

This is the beginning of a three-part series on building a user directory.

Part 1: Changing the contact fields on the user profile pages
Part 2: Building the user directory page template
Part 3: Building author templates and linking them in the directory

First, we’ll add some new fields: Twitter username, phone number, and job title. Then, we’ll remove the built-in fields we don’t want (all the IM handles). Finally, we add the filter that makes it all work. Here’s the code:

// change user contact fields
function change_contactmethod( $contactmethods ) {
  // Add some fields
  $contactmethods['twitter'] = 'Twitter Name (no @)';
  $contactmethods['phone'] = 'Phone Number';
  $contactmethods['title'] = 'Title';
  // Remove AIM, Yahoo IM, Google Talk/Jabber
  unset($contactmethods['aim']);
  unset($contactmethods['yim']);
  unset($contactmethods['jabber']);
  // make it go!
  return $contactmethods;
}
add_filter('user_contactmethods','change_contactmethod',10,1);

Put that in your theme’s functions.php file and have your users fill in the new fields! In the [link id=”2715″]next installment[/link], we’ll build the page template that displays the information.

WordPress contact, Users and Roles

This is an excerpt from Content Strategy for WordPress.My latest books are Content Strategy for WordPress (2015) and WordPress for Web Developers (2013). Sign up to be notified when I have a new book for you.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Footer

My Books

I’m a front end developer at Equinox OLI, working on open source library software. I was previously a freelance WordPress developer in higher education. You can get in touch here or on LinkedIn.

Copyright © 2025 Stephanie Leary · Contact