Answers.Body: <p>There's a CiviCRM navigation hook that you could use in an extension <em>but</em>...</p>
  
  <p>To me this is the wrong approach. Hiding the menu does not stop users from accessing those pages or using the API via JavaScript.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-06T09:36:01.707Z
Answers.Text: Thanks, I know that hiding a menu isn't a substitute for access control! However the requirement from the client is to hide the menu, in order to provide a simplified user interface for (un)certain users.
Answers.UserDisplayName: davejenx
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-05T16:25:03.883Z
Answers.LastActivityDate: 2016-04-05T16:25:03.883Z
Answers.UserDisplayName: JohnFF
Answers.Body: <p>I know this is an older post but I was looking to do something very similar and it took me a while to figure it out - so I'm sharing in case someone else finds it useful.</p>
  
  <p>I did use the hook_civicrm_navigationMenu. But most of the documentation surrounded how to add something, not remove it. I used the unset function (just like it is used in the hook_civicrm_tabset). The only tricky part is adding the right references to hide the correct menu. For me, I wanted to hide the Mailings menu for 'uncertain' users as @davejenx describes them.</p>
  
  <pre><code>// identify id of Mailings menu in $params array    
  $mailingsmenuID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Mailings', 'id', 'label');
  // remove the menu
  unset($params[$mailingsmenuID]);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-15T16:02:19.473Z
Answers.LastActivityDate: 2019-02-15T16:02:19.473Z
Answers.UserDisplayName: RayWright
Answers.Body: <p>Can this be done with Drupal user permissions (/admin/people/permissions) and roles? Our organization has a few staff users with varying levels of access; the "CiviCRM: access CiviCRM" permission is what gives users access to the top menu and the API, AFAIK. I've only given that permission to staffers who need full access, and i built custom menu blocks to give partial functionality to other staffers. </p>
  
  <p>So, I have a Member Relations ACL role that has the "Access CiviCRM" permission, and then other ACL roles that don't have that but are enabled on some subcomponents. We're Drupal 7/Civi 4.7.4 right now and this approach has been working for us since 4.4.x. The permissions for Civi are pretty granular and there may be a way to accomplish what you need without writing module code. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-05T18:39:48.407Z
Answers.LastActivityDate: 2016-04-05T18:39:48.407Z
Answers.UserDisplayName: Sean MacGillivray
Body: <p>Any suggestions for a not-too-hacky way to hide the whole CiviCRM top navigation menu for users who don't have a particular permission? I could load some menu-hiding css or js conditional on permissions, maybe in Civi pageRun+buildForm hooks or Drupal preprocess_page hook - but that feels hacky.</p>
  
  <p>CiviCRM 4.6, Drupal 7.</p>
  
Tags: <menu>
Title: Hide CiviCRM navigation menu based on permission
ThreadText: # Hide CiviCRM navigation menu based on permission
  
  (Asked by: username_0 on 2016-04-05)
  
  Any suggestions for a not-too-hacky way to hide the whole CiviCRM top navigation menu for users who don't have a particular permission? I could load some menu-hiding css or js conditional on permissions, maybe in Civi pageRun+buildForm hooks or Drupal preprocess\_page hook - but that feels hacky.
  
  CiviCRM 4.6, Drupal 7.
  
  **Tags:** menu
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-04-05. Score: 2
  
  There's a CiviCRM navigation hook that you could use in an extension *but*...
  
  To me this is the wrong approach. Hiding the menu does not stop users from accessing those pages or using the API via JavaScript.
  
  > **Comments:**
  > **username_0**: Thanks, I know that hiding a menu isn't a substitute for access control! However the requirement from the client is to hide the menu, in order to provide a simplified user interface for (un)certain users.  
  
  ---
  
  ### Answer by username_2 on 2019-02-15. Score: 1
  
  I know this is an older post but I was looking to do something very similar and it took me a while to figure it out - so I'm sharing in case someone else finds it useful.
  I did use the hook_civicrm_navigationMenu. But most of the documentation surrounded how to add something, not remove it. I used the unset function (just like it is used in the hook_civicrm_tabset). The only tricky part is adding the right references to hide the correct menu. For me, I wanted to hide the Mailings menu for 'uncertain' users as @username_0 describes them.
  // identify id of Mailings menu in $params array    
  $mailingsmenuID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Mailings', 'id', 'label');
  // remove the menu
  unset($params[$mailingsmenuID]);
  
  
  ---
  
  ### Answer by username_3 on 2016-04-05. Score: 1
  
  Can this be done with Drupal user permissions (/admin/people/permissions) and roles? Our organization has a few staff users with varying levels of access; the "CiviCRM: access CiviCRM" permission is what gives users access to the top menu and the API, AFAIK. I've only given that permission to staffers who need full access, and i built custom menu blocks to give partial functionality to other staffers.
  
  So, I have a Member Relations ACL role that has the "Access CiviCRM" permission, and then other ACL roles that don't have that but are enabled on some subcomponents. We're Drupal 7/Civi 4.7.4 right now and this approach has been working for us since 4.4.x. The permissions for Civi are pretty granular and there may be a way to accomplish what you need without writing module code.
  
  
  ---
  
  