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?
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.
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.
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
To test I did the following in edit mode:
I have a top menu that loads the top pages using the following code:
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?