+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / How to manage Tags field in user profile?

How to manage Tags field in user profile?

7 posts, 0 answered
  1. Menderes
    Menderes avatar
    4 posts
    Registered:
    15 Dec 2015
    04 Mar
    Link to this post

    Hello all,

    For a project i'm working on, I have added the classification "Tags" to the Sitefinity userprofile. So now i'm able to add and remove tags per user in the back-end of Sitefinity.  I would like to do this on the front-end. 

    The following page gives instructions for "normal" content items, http://docs.sitefinity.com/add-and-remove-taxonomies-remove-a-taxon-from-the-associated-content-item. But not for users. 

    Does anyone know how to be able to add and remove Tags from users?

    Thanks!

    Regards,

    Menderes Demir

  2. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    23 Sep 2016
    08 Mar
    Link to this post
    Hi Menderes,

    Please refer to the below KB article for more details about customizing the User Profile widget template and allow users to edit their profiles and update the desired custom fields from the frontend:

    http://www.sitefinity.com/developer-network/knowledge-base/details/how-to-customize-the-userprofile-widget-edit-mode-templates-using-out-of-the-box-fieldcontrols

    In the above KB you will find a link to the blog post where this is described in details: http://www.sitefinity.com/blogs/boyan-barnevs-blog-/2014/11/26/how-to-customize-the-userprofile-widget-templates

    I used the below markup for the HierarchicalTaxonField as it is shown in the blog post without changing any of the properties. This allows me to edit categories:

    <sf:HierarchicalTaxonField ID="Category" DataFieldName="Category" DisplayMode="Write" runat="server" TaxonomyMetafieldName="Category" TaxonomyId="e5cd6d69-1543-427b-ad62-688a99f5e7d4" WebServiceUrl="~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc" AllowMultipleSelection="true" Expanded="false" ExpandText="Click to add categories" BindOnServer="true" />

    Here is the sample markup I used for the FlatTaxonField which allow me to edit tags:

    <sf:FlatTaxonField ID="Tags" DataFieldName="Tags" LayoutTemplatePath="~/SFRes/Telerik.Sitefinity.Resources.Templates.Fields.FlatTaxonField.ascx" DisplayMode="Write" runat="server" TaxonomyMetafieldName="Tags" TaxonomyId="cb0f3a19-a211-48a7-88ec-77495c0f5374" WebServiceUrl="~/Sitefinity/Services/Taxonomies/FlatTaxon.svc" AllowMultipleSelection="true" Expanded="false" ExpandText="Click to add tags" BindOnServer="true" />

    I am also sending attached a short video for your convenience demonstrating the results after implementing the sample from the blog post.

    Regards,
    Sabrie Nedzhip
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Menderes
    Menderes avatar
    4 posts
    Registered:
    15 Dec 2015
    08 Mar in reply to Sabrie Nedzhip
    Link to this post

    Hi Sabrie,

    Thank you for your reply! I forgot to mention, the project is based on pure MVC. How can I implement this in the MVC user detail template?

    Regards,

    Menderes Demir

  4. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    23 Sep 2016
    11 Mar
    Link to this post
    Hello Menderes,

    In the MVC view of the profile widget you can access classification fields using the below sample which will return a TrackedList of Guids - the ids of the taxa. Here is an example for Tags:

    @Model.SelectedUserProfiles[0].Fields.Tags as Telerik.OpenAccess.TrackedList<Guid>

    Then you will be able to display the tags in the view by their ids.

    Here is how you can get the Tags count:

    @{
             var tags = Model.SelectedUserProfiles[0].Fields.Tags as Telerik.OpenAccess.TrackedList<Guid>;
             var tagsCount = tags.Count();
               
         }


    Regards,
    Sabrie Nedzhip
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  5. Menderes
    Menderes avatar
    4 posts
    Registered:
    15 Dec 2015
    11 Mar in reply to Sabrie Nedzhip
    Link to this post

    Hi Sabrie,

    Thank you for your reply. Getting tags from the (current) user was not the issue. Like my first post, I would like to be able to manage tags of a user.

    So being able to add and delete tags from a user on the front-end, without the need of being logged in the back-end of Sitefinity.

    With kind regards,

    Menderes Demir

  6. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    23 Sep 2016
    16 Mar
    Link to this post
    Hello Menderes,

    Please review the below documentation article related to the Profile widget configurations and check step 3 from the Advanced configuration section where you can find more details on how to make the custom fields editable:

    http://docs.sitefinity.com/feather-profile-widget

    Regards,
    Sabrie Nedzhip
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  7. Menderes
    Menderes avatar
    4 posts
    Registered:
    15 Dec 2015
    25 Mar
    Link to this post

    Hi Sabrie,

    Thank you for your reply. I have followed the instructions on the given page. It looks like it's based on regular fields. 

    I need to add an editable Tags field. Could you explain me how to add that kind of field?

    Thank you.

    With kind regards,
    Menderes Demir

7 posts, 0 answered