LinkItemCollection personalization feature

 

Hi.

I am using the LinkItemCollection property for my websites menu links, but some of these menu links I would like to hide from the users based on user roles. Unfortunately, it seems that the LinkItemCollection property does not support personalization(like ContentArea does) and I can't just change it to ContentArea property, because there is a lot of content already using this LinkItemCollection.

Is there a way to add personalization feature to this property? Or some kind of workaround?

Thanks!

#190692 Apr 16, 2018 10:29
  • Tomas Hensrud Gulla
    Member since: 2010
     

    You could make the content you add to the LinkItemCollection accessible only to users with specific roles?

    #190693 Edited, Apr 16, 2018 10:54
  • Jeroen Stemerdink
    Member since: 2009
     

    You can loop through the linkitems in the collection I guess, get the contentdata with 'IContent item = linkItem.GetContentData<IContent>();' and check the access?

    #190698 Apr 16, 2018 12:21
  • Tahir Naveed
    Member since: 2010
     

    Old blog post but worth reading and exploring.

    https://world.episerver.com/blogs/Anders-Hattestad/Dates/2011/6/How-to-make-Property-LinkCollection-use-Visitor-Groups/

    If nothing works then try converting the property to contentarea & write a small rountine to get all the content from linkitemcollection and put it into new contentarea. It should be pretty simple.

    #190702 Apr 16, 2018 12:45
  •  

    Hi. In the link you send, he seems to be using a old episerver version, do you know if his example still works for newer versions?

    #190703 Apr 16, 2018 12:57
  • Tahir Naveed
    Member since: 2010
     
    #190704 Apr 16, 2018 12:59
  • valdis iljuconoks
    Member since: 2011
     

    hi,

    honestly I don't think you should go that path as approach Anders used is out-dated already to put in that way. I would recommend to to convert to content area (if possible) and personalization there is out-of-the-box.

    #190790 Apr 16, 2018 22:14
  •  

    Hi. I think you are right, I guess I will have to either convert it to a ContentArea or wait on Episever to add this feature to the LinkItemCollection :)

    #190875 Apr 18, 2018 8:36