Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

"View as" not working in custom top menu


I have a top menu that loads the top pages using the following code:

//get top level pages visible and in menu
IEnumerable allChilds = repository.GetChildren(ContentReference.StartPage);
IEnumerable filteredChilds = FilterForVisitor.Filter(new PageDataCollection(allChilds)).Where(p => p.IsVisibleOnSite() && p.VisibleInMenu);

My problem is that when the editor is using the "view as" and enables a specific visitor group, everything changes as it should except the menu. It seems like the p.IsVisibleOnSite() ignores the  chosen visitor group"

How can I fix this, anyone got any ideas?

Aug 05, 2014 10:28

IsVisibleOnSite() has nothing to do with access rights, ref:

FilterForVisitor.Filter() runs FilterPublished(), FilterAccess() and FilterTemplate().

I thought that FilterAccess would remove any pages not relevant for chosen visitor group.

Could you try also running FilterContentForVistor?

Aug 05, 2014 12:08

Thankyou for your answer Mari.

Tried FilterContentForVistor and same result. Note that this works perfektly in non-admin mode, using the same code. So I am thinking its editor-mode related.

Aug 05, 2014 13:34

Ah, then FilterForVisitor does what it's supposed to.

I did a quick test in one of my projects and it works both from view mode and using "View as" functionality (using version 7.8). I gave access rights (read access) to the visitor group and removed read access for "Everyone" for the test-page.


Aug 05, 2014 14:02

Mari, could you elaborate? Should I do extra tests in admin mode. Basically I just want to emulate what the users see. I'm on 7.5

Aug 05, 2014 14:18

To test I did the following in edit mode:

  • Edit one of the pages in that is part of the main menu
  • Using the "Visible to" property I removed read access for "Everyone" and added read access for "VisitorGroup A"
  • I then navigated to start page, used "View settings" (eye icon) to select view for "VisitorGroup A".
  • I also opened the site in another browser where I was not logged (not part of visitor group) in to verify that the page was not visible
Aug 05, 2014 15:06
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.