phpdrupaldrupal-9

Display menu item to anonymous user even when access permission is set to authenticated users


I have create a page through view and set the access permission as authenticated users

i have added the page link to the menu. Now the menu link is visible to only authenticated user as expected

My requirement is i want to show the menu link to anonymous users too, so the user can click the link and see the page content(Access denied message).

Im using Drupal 9 version. I have tried using Menu Items Visibility, and Menu Item Visibility, but no luck

Is there any way to do this either through hook or any contributed modules


Solution

  • Please use this module for menu link access: https://www.drupal.org/project/menu_item_role_access

    This is work for me

    steps: 1)install module 2)add separate link for only anonymous user which is not display in any other role and add link path for access denied page