Hide Specific Part of a Menu Based on Logged in User Status/Role

We recommend creating more than one menu per layout to specify users' views based on their role/status. However, if you’re looking for a bit of code to…

  • Not yet re-checked
  • Classic builder

Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

Screenshot for “Hide Specific Part of a Menu Based on Logged in User Status/Role”

We recommend creating more than one menu per layout to specify users' views based on their role/status. However, if you’re looking for a bit of code to hide an item if the user is not logged in, you can use the following code.

Step 1

Copy your specific selector as seen in the image below.

Screenshot for “Hide Specific Part of a Menu Based on Logged in User Status/Role”

Step 2

Copy and paste the following code into the JavaScript tab of the page and remember to change ‘PASTE_SELECTOR_HERE’ with the selector you copied above.

Text
var selector = 'PASTE_SELECTOR_HERE';
$(function() {
    var loggedInUser = '{loggedInUser.Name}';
    if (!loggedInUser) {
        console.log('Not Logged In');
        $(selector).css('display', 'none');
    }
});
Screenshot for “Hide Specific Part of a Menu Based on Logged in User Status/Role”

Original Community Post:

Hide a title - Code CSS - Community Discussions / How Do I - Tadabase Community

Was this page helpful?

Something wrong or missing on this page? Tell us.