Hide pages in menulink for visitors

Hi

I would like to hide pages in menulink pagetype if the user in not logged in.
Is there a way to implement this when retrieving pages for menu.

TopNavigation.cs

  return Page.GetFromIDs(topMenuSection.Pages, _token)
                           .Where(x => x.IsPublished)
                           .Select(page =>
                               new ContentLink
                               {
                                   Name = page.ShortName,
                                   Url = page.GetUrlToPage(_webSiteId, _isInAdministrationMode),
                                   IsSelected = _selectedStructureId.Contains(page.ID)
                               })
                           .ToList();

Litium version: 6.3

Since the token will limit the results from GetFromIDs to pages the token has read access to, you could use groups to control the access.

You could create a smart group LoggedInUsers with all users that has an email (or any other field that would catch 'em all) and then only give that group read access to the page.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.