How to hide menu before login in developer portal

How to hide the top navigation bar menus in the Developer Portal. Only to be displayed upon authoriz...

Before login only register and login should display

7824-erra.png

after login other menus should display as below

7825-errb.png

Solved Solved
0 2 383
1 ACCEPTED SOLUTION

As always with Drupal there are multiple ways to do things, and which method you choose depends on your requirements.

Here is a screenshot of my Drupal dev portal, viewed from an anonymous user. As you can see all of the links in the main menu are present and visible.

7846-screenshot-20181214-111510.png

The simplest way to restrict menu items (and the things they point to) so that unauthenticated users cannot see these items, is to use the builtin permissions module.

  1. login as admin
  2. navigate to Admin > People > Permissions
  3. scroll down to "View Published Content"
  4. Uncheck the box in that row associated to anonymous users.

    7842-uncheck-the-box.png

  5. Scroll all the way down to the bottom of the page
  6. click the button labeled "save permissions"
  7. wait til that finishes.
  8. flush all Drupal caches

    7845-flush-all-caches.png

  9. in another browser, where you are not logged-in, load the home page of your devportal. (If you use the same browser, then use an Anonymous or Incognito window.)

You should see no menu items.

Actually in my case, in my portal, an anonymous user will still see the FAQS menu item.

7843-screenshot-20181214-102216.png

(This may not be the case for you, if you are using a different FAQ module.) This is by design! If you want anonymous users to also not be able to see the FAQ, you can use the same Admin > People > Permissions screen to disable the FAQ module. Follow the same steps as I just described, but uncheck the box for "View FAQ Pages".

7844-screenshot-20181214-110913.png

After I login, I will be able to see all the menu items, because I will be authenticated. (No longer anonymous).

If this simple approach does not work for you, try the "Content Access" module in drupal, as described here.

It is installed by default with the Apigee Edge devportal, but may not be enabled.

View solution in original post

2 REPLIES 2

As always with Drupal there are multiple ways to do things, and which method you choose depends on your requirements.

Here is a screenshot of my Drupal dev portal, viewed from an anonymous user. As you can see all of the links in the main menu are present and visible.

7846-screenshot-20181214-111510.png

The simplest way to restrict menu items (and the things they point to) so that unauthenticated users cannot see these items, is to use the builtin permissions module.

  1. login as admin
  2. navigate to Admin > People > Permissions
  3. scroll down to "View Published Content"
  4. Uncheck the box in that row associated to anonymous users.

    7842-uncheck-the-box.png

  5. Scroll all the way down to the bottom of the page
  6. click the button labeled "save permissions"
  7. wait til that finishes.
  8. flush all Drupal caches

    7845-flush-all-caches.png

  9. in another browser, where you are not logged-in, load the home page of your devportal. (If you use the same browser, then use an Anonymous or Incognito window.)

You should see no menu items.

Actually in my case, in my portal, an anonymous user will still see the FAQS menu item.

7843-screenshot-20181214-102216.png

(This may not be the case for you, if you are using a different FAQ module.) This is by design! If you want anonymous users to also not be able to see the FAQ, you can use the same Admin > People > Permissions screen to disable the FAQ module. Follow the same steps as I just described, but uncheck the box for "View FAQ Pages".

7844-screenshot-20181214-110913.png

After I login, I will be able to see all the menu items, because I will be authenticated. (No longer anonymous).

If this simple approach does not work for you, try the "Content Access" module in drupal, as described here.

It is installed by default with the Apigee Edge devportal, but may not be enabled.

Thank you Dino...it works fine..But links in the footer like Priviacy Policy ,Contact ,Terms & Use content also not able to view for visitors.