CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Removing the top menu bar completely
Pages: [1]

Author Topic: Removing the top menu bar completely  (Read 2170 times)

charleslcso

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 0
  • CiviCRM version: 3.2.5
  • CMS version: Drupal 6.19
  • MySQL version: 5.1.50
  • PHP version: 5.3.2
Removing the top menu bar completely
January 21, 2011, 11:50:22 pm
I'd like to build a set of custom menu links to CiviCRM functions, instead of opening up the top menu bar for my users.

How do I disable the whole, black menu bar at the top of the screen?

How do I show the bar to a specific group of users only?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Removing the top menu bar completely
January 22, 2011, 11:42:04 am
Look at templates/CRM/common/Navigation.tpl to remove the bar altogether.

To show it to only certain users could also be done in the same place.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Removing the top menu bar completely
January 23, 2011, 03:40:08 pm
You are using Drupal, so I would not recommend making any changes to the CiviCRM code at all.  There is a much easier way, using CSS and Drupal .tpl files in your Drupal theme.

Hide the menu by using the id selector of the menu and the display: none; CSS.

For instance:

Code: [Select]
#civicrm-menu { display: none; }

To show/hide the menu conditionally, add some code to your page.tpl file in your Drupal theme.

The Drupal code will need to get, as an array, the User's roles.  I think this is $user->roles but check that at the Drupal website.

Then set up a conditional using if/else statements that will print the CSS code (shown above) if they are a role that should NOT see the menu.  You will want to place this code on the BOTTOM of your .tpl file.   Check in various browsers to make sure the behavior is consistent.

Conceptually this is how you do it, and how I have done it.  But I don't have the exact syntax handy.  If you can't figure it out, repost and I will give you the exact code Monday.
« Last Edit: January 23, 2011, 03:42:28 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

charleslcso

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 0
  • CiviCRM version: 3.2.5
  • CMS version: Drupal 6.19
  • MySQL version: 5.1.50
  • PHP version: 5.3.2
Re: Removing the top menu bar completely
January 23, 2011, 05:00:31 pm
Quote from: Stoob on January 23, 2011, 03:40:08 pm
You are using Drupal, so I would not recommend making any changes to the CiviCRM code at all.  There is a much easier way, using CSS and Drupal .tpl files in your Drupal theme.

Hide the menu by using the id selector of the menu and the display: none; CSS.

For instance:

Code: [Select]
#civicrm-menu { display: none; }

To show/hide the menu conditionally, add some code to your page.tpl file in your Drupal theme.

The Drupal code will need to get, as an array, the User's roles.  I think this is $user->roles but check that at the Drupal website.

Then set up a conditional using if/else statements that will print the CSS code (shown above) if they are a role that should NOT see the menu.  You will want to place this code on the BOTTOM of your .tpl file.   Check in various browsers to make sure the behavior is consistent.

Conceptually this is how you do it, and how I have done it.  But I don't have the exact syntax handy.  If you can't figure it out, repost and I will give you the exact code Monday.

Fantastic!

Thanks very much.

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Removing the top menu bar completely
January 24, 2011, 09:55:02 am
As an afterthought, jQuery might be more consistent on different browsers.   Instead of the CSS, use Jquery.

Code: [Select]
<script>
$('#civicrm-menu').hide();
</script>
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Removing the top menu bar completely

This forum was archived on 2017-11-26.