# How can I hide main menu items based on user login details

**URL:** <https://community.fliplet.com/t/how-can-i-hide-main-menu-items-based-on-user-login-details/552>\
**Category:** Get Help\
**Tags:** login\
**Created:** [July 31, 2023, 3:20pm UTC](https://community.fliplet.com/t/how-can-i-hide-main-menu-items-based-on-user-login-details/552 "2023-07-31T15:20:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MakaylaPaasch](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@MakaylaPaasch](https://community.fliplet.com/u/MakaylaPaasch)\
**Post date:** [July 31, 2023, 3:20pm UTC](https://community.fliplet.com/t/how-can-i-hide-main-menu-items-based-on-user-login-details/552/1 "2023-07-31T15:20:51Z")

</div>

How can I hide items in a main menu for specific users based on their login details?

---

<div class="post-metadata">

**Author:** ![Deb](https://dub1.discourse-cdn.com/flex017/user_avatar/community.fliplet.com/deb/32/159_2.png) [@Deb](https://community.fliplet.com/u/Deb)\
**Post date:** [July 31, 2023, 4:42pm UTC](https://community.fliplet.com/t/how-can-i-hide-main-menu-items-based-on-user-login-details/552/2 "2023-07-31T16:42:23Z")

</div>

Hi Makayla,

You need a simple JS code snippet for this which is provided below. This code snippet assumes you have the hamburger menu. If you want this to be applied to every page then add this to the Global JS whereas if you want this applied on one page then add to the screen JS.

```js
Fliplet.User.getCachedSession().then(function(session) {
  var user = _.get(session, 'entries.dataSource.data');

  if (!user) {
    return; // user is not logged in
  }
  
  $('.linked.with-icon.focus-outline').each(function(index, element) {
    //Enter matching menu item name here
    if (
      $(element)
        .text()
        .trim() === 'News'
    ) {
      //Change logged in user property here
      if (user.Admin === 'Yes'){
        $(element).hide()
      }
    }
  });
});

```

Hope this helps,  
Deb
