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.

Does anyone know a way (either programmatically or plugin) to assign tags to users.

I want to build a list of user interests as tags so I can match related content to their interests?

Cheers,

Chris.

share|improve this question
1  
---------- This was just released this month: wordpress.org/plugins/user-tags –  Morgan Sully Mar 24 at 15:57
add comment

2 Answers

I think this is what you are looking for: http://codex.wordpress.org/Function_Reference/update_user_meta

Here is a example of how this can be achieved: http://inchoo.net/wordpress/programatically-add-metadata-to-user-accounts-in-wordpress/

share|improve this answer
    
Thanks for the response. I'm not sure this is quite what I'm looking for. This is because the examples you've given show a one to one relationship between the meta field and value. I want to able to assign any number of tags to a user. For example if they liked sports the tags associated with their 'interest' fields would be 'football', 'hockey' 'basketball' etc. All these fields would be pre-existing post tags that I could assign to the user. Does this make sense? –  chris Aug 8 '11 at 11:46
    
I'm not sure you're right, user7726, that user meta fields have to be 1-to-1. The codex page says "use the $prev_value parameter to differentiate between meta fields with the same key and user ID." This seems to imply that users can have multiple entries for "my_tag." On the other hand, I think you will have to use add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false) rather than update_user_meta. By default add_metadata doesn't check whether $user_id already has $meta_key. –  Chris Carson Aug 8 '11 at 13:07
    
@Chris Carson, isn't it better to use update_user_meta if he wants to update this later? –  Steven Aug 8 '11 at 14:59
    
@user7726 - Are you registering users? Or is the user signing up themselves and they select their interests? Either way, you only need to loop through the selected fields and update / add the fields. –  Steven Aug 8 '11 at 15:01
1  
@Steven I don't think it's possible to do "multiple metas with the same key and user_id" with update_user_meta. I think you have to use the lower-level metadata functions add_metadata and update_metadata. I may be wrong. –  Chris Carson Aug 8 '11 at 15:25
show 1 more comment

It's a quite old question, but I'm answering it as it might help other users who come looking for same.

To assign User Tags, you can use the Plugin. Wordpress has built-in support for it, the Plugin allows you to do it the easy way.

Instead of manually registering User Taxonomies, It allows you to directly create the Taxonomies and provides a template for each tag, You can check the demo link here: User Interests:

You can filter the Title, the listing Or the empty list message as per need using the filters:

  • ut_template_heading
  • ut_tepmplate_content
  • ut_template_content_empty
share|improve this answer
add comment

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.