Associate user to tags

Topics: Customizing Orchard
Feb 21, 2013 at 6:29 PM
Hi all,

I am just starting to use Orchard and we are creating a module where we do a special user register form.

When a user is registering in, we want him to be associated with specific tags. So later on we can show for him the content associated with the tags he is interested.
For example, user Tom is interested in Cars, Mobiles and Training. This 3 will be the tags that we want to create and associate with the user automatically.

For doing it, should we create a TagsPart.cs in our Model folder? Then, creating also a table with the association between tag and the user.
How can I associate a user with tags programmaticaly?

Thanks for your help!! :)
Feb 21, 2013 at 7:13 PM
What you could do is attach the TaxonomyField to the UserPart. That way it's easy to assign Terms to a user.
Feb 22, 2013 at 8:58 AM
Thanks for your answer but I do not really know all this concepts very well.

Please, could you explain better how is a taxonomyField and how can I add it?
Feb 22, 2013 at 9:54 AM
Edited Feb 22, 2013 at 9:54 AM
There's a video on using Taxonomies here:
Once you've checked that one out I would setup a simple Orchard site and try it for yourself.
Once you are familiar with the concept and its usage, as an exercise, do the following:
  1. Create a new Taxonomy called "Tags" and define a couple of terms (e.g. Cars, Mobiles and Training).
  2. Create a new part called "UserProfilePart" and attach the TaxonomyField.
  3. Go to the User content type and attach the "UserProfilePart" and configure the TaxonomyField to use the "Tags" taxonomy.
Now you should be able to create new users and assign tags.
Next steps would be to do that programmatically. You can see how that works by looking at the Taxonmies source code (which is Contrib.Taxonomies at the moment).