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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • A bash script to help me customize navigation menu
Pages: [1]

Author Topic: A bash script to help me customize navigation menu  (Read 574 times)

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
A bash script to help me customize navigation menu
August 10, 2011, 11:36:34 am
Hi All,

I wanted to customize the navigation menu on quite a few different sites.

So I wrote a bash script to help out.
As it is, it adds a link to the Help menu pointing to the Floss manual.

Code: [Select]
#!/bin/bash

# Ask for MySQL credentials...
/bin/echo "
We need to know the MySQL user name
on this machine...
   
Default=root
---------------------------------------------------"
read MYSQL_USER
MYSQL_USER=${MYSQL_USER:='root'}
 
/bin/echo "
The password to the MySQL database on
this machine is?
---------------------------------------------------"
read -s MYSQL_PASS
 
/bin/echo "
The the database to update is?
---------------------------------------------------"
read MYSQL_DB
 
# In this example, 'Help' is the parent item
RESULT=`/usr/bin/mysql -u $MYSQL_USER -p$MYSQL_PASS -h localhost<<SQL
  USE $MYSQL_DB;
  SELECT id FROM civicrm_navigation WHERE label = 'Help';
  quit
SQL`
 
RESULT=`echo $RESULT | cut -d ' ' -f 2`

echo $RESULT

# Updating the 'About' just adds a separator
/usr/bin/mysql --verbose -u $MYSQL_USER -p$MYSQL_PASS <<EOF
USE $MYSQL_DB;
INSERT INTO civicrm_navigation
  (domain_id, label, name, url, permission, permission_operator, parent_id, is_active, has_separator, weight)
  VALUES
  (1,'Floss Manual Civicrm','Floss Manual Civicrm','http://www.flossmanuals.net/civicrm','access CiviCRM','AND',$RESULT,1,0,8);

UPDATE civicrm_navigation
SET has_separator = 1
WHERE label = 'About';
EOF

Makes it a quick change.
Edit to your taste.
Run /index.php?q=civicrm/menu/rebuild&reset=1 after you edit.

Cheers,
GF

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • A bash script to help me customize navigation menu

This forum was archived on 2017-11-26.