56 responses to “Adding and using custom user profile fields”

  1. Huzzer Magazine

    Such a great tutorial that you give up there. I will definitely use it for my blog. The best part of the above tutorial is the way you integrate Twitter with user profile – by adding another part of the page when I key in my twitter user profile.

    Besides Twitter’s profile link, it will definitely a good idea to put social bookmarking site especially Stumble Upon’s thumb up icon as I believe that by having that section, it can channel reader’s attention into the section.

    Other than that – link to the latest post of the user maybe – especially for guest blogger as it can help to increase the incentive and motivation of the guest blogger.

  2. Chris Hajer

    Hi Justin. Is there a way to extend this to registration, so that the extra fields are required (maybe optionally required, but the input fields would be there) upon registering? Or alternately, maybe just direct people to their profile upon logging in, to complete their profile? I am thinking of using something like this for extended profiles, sort of a membership database, something I haven’t found a good version of yet (and I think you had similar trouble finding a while back?) It’s an area that’s lacking WordPress plugins.

    I would use this for simple things like name, address, phone, interests, etc. All the things you’d need to know about a member of a club.

  3. Jean-Baptiste Jung

    Justin,
    I’m never disapointed with the quality of your work. This tutorial is simply excellent, I have learnt something soooo cool today :)

    Thanks for sharing all this usefull info with us. Have a nice day!
    Jean

  4. Rarst

    As for usage ideas I am slowly planning collaboration/hobby site, most probably on P2 theme (if I don’t find something more fitting).

    I want to give users some degree of control over what parts (probably compartmentalized as widgets) of site they see, as well as option to filter RSS-embebed content with their keywords.

    I hadn’t even started on actual code, but this technique seems like it will be of use. Thanks for explaining it!

  5. visaap

    This week we decided, for the project I’m involved in, that we want to use extra profile-info which the users can manage by themselves; and here is the answer to it.
    Thanx, it’s really a timesaver and right on time :D

  6. BluXis » Aggiungere un campo personalizzato nel profilo utente su Wordpress

    [...] segnalo un’ottima guida che vi permetterà di aggiungere un campo personalizzato nel profilo utente del vostro blog con [...]

  7. Andrea_R

    Nicely done – here’s another idea, instead of the code in functions.php, roll it all into one file, drop it in mu-plugins. Add some shortcode options then users across a WPMU install can whip up their own profile area wherever they like.

  8. WordPress Weekend Resources: September 11, 2009 | Theme Lab

    [...] Adding and using custom user profile fields – In another great tutorial from Justin Tadlock, he goes over how to use user profile fields in your theme, as well as how to make your own custom user profile fields such as a “Twitter” field. This can be useful on a multi-author blog to display author info on each of their respective posts. [...]

  9. Adam W. Warner

    Great tutorial Justin, thanks a lot. I had the same thought as Chris above. I know there are a couple plugins out there that attempted the addition of form input fields on the registration form, but if this could ultimately be included in your user role plugin, it would simply be fantastic.

  10. Joost de Valk

    Hey Justin,

    it’s become a lot easier to do this with a patch that I proposed and wrote a couple months back: http://core.trac.wordpress.org/changeset/11784. This is in trunk and will be included, as it looks right now, in 2.9, after that, user fields are filterable, and you could easily add the Twitter profile field just by doing this:

    function add_twitter_contactmethod( $contactmethods ) {
    	// Add Twitter
    	$contactmethods['twitter'] = 'Twitter';
    	return $contactmethods;
    }
    add_filter('user_contactmethods','add_twitter_contactmethod',10,1);

    I’ll do a quick post detailing it all :)

  11. Andreas Graf

    I could think about custom user fields like “Hobbies”, “Location” or “Occupation” to make the users less faceless.

  12. Joost de Valk

    Post done, check it out: User Contact Fields in WordPress 2.9.

  13. Adam W. Warner

    I have a feeling your to-do list looks a lot like this.

  14. Amanda

    This is wonderful and so easy to follow, thanks so much for sharing!

    I’m trying to incorporate it into the author archives using this method: http://codex.wordpress.org/Author_Templates

    Is there a way to code the twitter link so that it’ll work outside of the loop?

  15. westi

    Justin this look cool and familiar (http://blog.ftwr.co.uk/archives/2009/07/19/adding-extra-user-meta-fields/)

    With regard to the improvements in 2.9 – what use-case do you have for anything other than a text box for a contact info attribute of a user?

    (BTW – You don’t need the current_user_can() check when processing the new form fields as the capability has already been checked by the main form processing code but it is always better to be safe than sorry)

  16. CG

    i’m doing a site whereby each member has their own post… I’d like to see this profile page used as a means to set up their post…. maybe even incorporate a basic tinymce editor?

  17. Deb

    Another very informative post Justin. I keep coming back to your site to learn more. Keep up the good work.

  18. amy gail

    I learn so much from you Justin!
    Thanks for this.

    (may I take this opportunity to tell you how nice it would be to have a search option on your site?)

  19. amy gail

    I’m using something similar to this to add links to iTunes and CDbaby for the discography pages on a site I’m working on (http://burntsugarindex.com/making-love-to-the-dark-ages/) but I think your method is a bit more elegant.
    I’m going to have to revisit that…

  20. amy gail

    You’re right – Not so much user profiles
    - I’m thinking along the line of the way you’ve inserted the twitter user name via custom fields and hooked them into the author meta.

    In my case – each CD has it’s own link to iTunes and CDbaby- I’m using custom fields (in custom single post templates) for that now and it works. Your post has me thinking that I can do it a bit more elegantly.
    That’s all

  21. Movers Clendaniel

    I’m jealous- what I wouldn’t give to be able to create this kind of code myself! For now, I’ll just have to rely on you. :-)

  22. Pete

    Hey Justin… I would love to see this code along with your user management code to be used for a comprehensive dating site for wordpress…. but integrated with a paypal/different costs for different features thingy.

  23. CG

    hi Justin.. how would I use this with a text area, checkboxes, drop down list etc…

  24. imtiedup

    As to extra fields, it would be nice to show either the most recent posts by the user, ‘title-date’ format, or even better allow the author to set permanent links to their favorite posts or both.

  25. John

    This is one area of wordpress that has really been overlooked. So many volunteer organizations use wordpress and could use a membership directory.

    It should be easy to add extra users fields as needed (address, phone, etc).
    The user should have an option button to opt in or out of appearing in the directory.
    The directory would be protected and not viewable unless you were log in.
    The admin would have a slightly different view of directory so everyone is included.
    Even better would be option buttons next to each field to decide which info is ok to display.
    A drag and drop interface to customize where info goes on your directory page.

    This would make wordpress more useful to churches, neighborhood associations, hobby groups etc.

  26. Da importância de conhecer bem o WordPress » Comunidade WordPress-BR

    [...] Campos personalizados: como adicionar informações extras, na hora de cadastrar posts, páginas ou usuários; [...]

  27. Michael

    I’m going to look into doing that – adding custom fields helps your audience tell you more about themselves, and that creates a nice report between you, which, needless to say, is highly beneficial for your blog and online business.

  28. Abu Aufa's Weblog

    Great tutorial.. Thanks Justin..

  29. Vince

    Great TUT! Can you think of a way to add an mp3 upload field that will allow the visitor to listen to an mp3 sample of someone’s music, such as a band?

  30. Edwin

    Justin, really a outstanding Tut. Thank you fort sharing this.
    Like Vince I would like to know if there is a way to upload. In my case an .jpg or .gif file.
    Any ideas on that.?

  31. Martin

    thats a cool tutorial, thank you very much!
    i’m running a website for a cycling club, and i wanted a (protected) page to list all the members full names and contact info like mail adress, home and work phone nr etc.
    Also, each member should be able to modify his own (but only his) data.
    Think your tutorial gave me exactly the tools needed for this.. :)

  32. manuel

    great idea.

    short and powerful.

    Thks

  33. WordPress Weekend Resources: September 11, 2009

    [...] Adding and using custom user profile fields – In another great tutorial from Justin Tadlock, he goes over how to use user profile fields in your theme, as well as how to make your own custom user profile fields such as a “Twitter” field. This can be useful on a multi-author blog to display author info on each of their respective posts. [...]

  34. Daily Digest for September 27th | More Than Scratch The Surface

    [...] Shared Adding and using custom user profile fields [...]

  35. rZr

    Hya, ty for the code/tutorial. You are mentioning an plugin, what will this plugin do exactly?
    Will it add custom fields to User Profile, and automaticly add them to the register process? Maybe also an customized register ‘page’?

    If so I would gladly beta test anything for you. Else I have to write them myself, or together even.

  36. Dan Gayle

    I’ve been working on building up a new theme profile page that conglomerates all of the writer’s social media profiles into one spot, and I think this will work perfectly! Thanks for the tutorial.

  37. tgrimsley

    Great work and easy to follow instructions. Keep up the excellent work

  38. Pete

    Hi Justin… you still alive these days?

    Just wondering…
    1. Are you planning to release this nifty little code as a plugin?

  39. Manic

    Thanks for good article. I appreciate your thoughts and information presented at this time.

  40. Nate Williams

    This is so awesome .. thanks! It would be cool to be able to upload various images as well associated with authors .. that could be your next tutorial .. great work!

  41. Ron

    You are a bloody champion!!!!

  42. Jauhari

    I will use it Justin, thanks for this tips

  43. Alex

    Another very informative post Justin. I keep coming back to your site to learn more. Keep up the good work.
    This is a Life!

  44. slee

    is there a way to add the First Name and Last Name fields onto the regitration page?

  45. Laura Kalbag

    Awesome tutorial, thanks!

    I’ve used it to create a load of biography fields for a band site, so ‘Instrument’, ‘Musical History’ and ‘Influences’ all feature in there. So cool :)

  46. Patrik

    Great tutorial!!! I just wonder how you get a textarea instead of regular text field?

  47. Steve B.

    Justin– as always, great tutorial.

    I’d love to take some of these custom fields and show them in the comments form next to “Website” for instance. Is this possible with these custom fields?

    Steve

  48. Debbie

    This is a great tutorial.

    I’m doing something similar to what you’ve shown, but have run into one problem – the custom meta data I enter on the profile form gets saved (it displays in my custom author template fine), but once submitted the custom fields are blank on the profile form unless I’m looking at it from within the admin side.

    This is the basic formatting for all the text fields:

    Is there something obvious that I’m doing wrong?

  49. Debbie

    Let me try that again:

    <input type="text" name="company" id="company" value="ID ) ); ?>" />
  50. Nirave

    For some reason I can’t get this to work.

    My profile page doesn’t contain the twitter section & going to a post having put the php my_author_box in single.php brings up this error:

    Fatal error: Call to undefined function my_author_box() in /home/mobileus/public_html/blog/wp-content/themes/inove/single.php on line 58

    (line 58 is where the php my_author_box thing is.)

    Anyone help by any chance? (REALLY WANT THIS LOL!)

  51. Adding Custom User Meta to WordPress User Profiles » WordPress, Electronic Publishing, and Geek Culture » Daniel J. Quinn » DQuinn.net

    [...] reconsider this approach, as there is now a way to add custom user meta via core functions. Visit Justin Adlock's blog for a short and sweet summary of how to do [...]

  52. Daniele Savasta

    Hi! Thanks for your guide it’s really usefull.
    But I need some more suggestion, what I need to do if I want to upload a pdf file also?
    Something like a resume attached to the profile.
    Thank you so much.

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.

Please use your real name or a pseudonym (e.g., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.