Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How do I create a new usermeta field with a drop down selection values?

Im want to create a conditional statement for all users with a certain value of the new custom field I want.

For example,

The new field would be: Approved The drop down values are: Yes and No

The conditional statement will recognize all users with the Approved field value of Yes. Then it will post a code.

Im working with the wp_get_current_user function(), which does exactly what I need, but I just need a new custom usermeta field. In the example the new usermeta field would be "artwork_approved."

Example:

wp_get_current_user();
if ($current_user->artwork_approved == 'Yes'){
    echo 'Thank you for approving your artwork!';
}

There seems to be no plugin for this and I really need this feature. I would really appreciate some advice on creating a new usermeta with drop down options.

Thanks a lot!

share|improve this question
2  
you have 14% accept rate , please go back to your old questions and accept some answers. Its the least you can to to thank users of the community for there time in helping you out. –  Bainternet May 26 '11 at 16:20
    
+1. You won't receive good answers to new questions with that accept rate. –  MZAweb May 26 '11 at 17:00
    
What can I do to improve my accept rate? –  user1893 May 26 '11 at 17:54
    
Go to your past asked questions and accept the correct answer. –  MZAweb May 26 '11 at 19:08
    
Thanks, will do! –  user1893 May 27 '11 at 13:16

1 Answer 1

up vote 2 down vote accepted

You need to hook edit_user_profile to add your custom inputs.

Then, you need to hook the profile_update action and use the function add_user_meta to add the metadata

share|improve this answer
    
That's what it boils down to. Here's a good tutorial showing those hooks in action: justintadlock.com/archives/2009/09/10/… –  goldenapples May 26 '11 at 17:21
    
I found this great plugin that lets you create new usermeta fields, Register Plus Redux. It does exactly what I need. Thanks for the feedback! –  user1893 May 27 '11 at 14:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.