I have installed the menu per role module and i would like to know how to use its patch.
What shd i do exactly to get it working properly

The Readme.txt says
"Installation : Unfortunately you need to patch the drupal file includes/menu.inc. Use the the patch provided with the module. If you don't know how to patch, you can just insert the three additional lines manually - but remove the leading plus. Then copy the module's whole directory in your drupal modules directory and activate it."

The patch file has these codes:

       // If the administrator has changed the item, reflect the change.
       if ($item->type & MENU_MODIFIED_BY_ADMIN) {
+        if (module_exists('menu_per_role') && !is_null($access = menu_per_role_access($item->mid))) {
+          $_menu['items'][$item->mid]['access'] = isset($_menu['items'][$item->mid]['access']) ? $_menu['items'][$item->mid]['access'] && $access : $access;
+        }
         $_menu['items'][$item->mid]['title'] = $item->title;
         $_menu['items'][$item->mid]['description'] = $item->description;
         $_menu['items'][$item->mid]['pid'] = $item->pid;

The file includes/menu.inc is has many lines of text and codes. Where shd i insert the patch and which are the lines from the patch tht i need to insert?

pls help.
thnks

Comments

nijuley’s picture

Find the code around line no:1129(menu.inc)

 if ($item->type & MENU_MODIFIED_BY_ADMIN) {
         $_menu['items'][$item->mid]['title'] = $item->title;
         $_menu['items'][$item->mid]['description'] = $item->description;
         $_menu['items'][$item->mid]['pid'] = $item->pid;

and replaced by the code

if ($item->type & MENU_MODIFIED_BY_ADMIN) {
     if (module_exists('menu_per_role') && !is_null($access = menu_per_role_access($item->mid))) {
     $_menu['items'][$item->mid]['access'] = isset($_menu['items'][$item->mid]['access']) ? $_menu['items'][$item->mid]['access'] && $access : $access;
    }
    $_menu['items'][$item->mid]['title'] = $item->title;
    $_menu['items'][$item->mid]['description'] = $item->description;
    $_menu['items'][$item->mid]['pid'] = $item->pid;

This is the patch code

Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.145
diff -u -r1.145 menu.inc
--- includes/menu.inc	2 Jan 2007 05:05:38 -0000	1.145
+++ includes/menu.inc	6 Jan 2007 17:57:59 -0000
@@ -1129,6 +1129,9 @@
 
       // If the administrator has changed the item, reflect the change.
       if ($item->type & MENU_MODIFIED_BY_ADMIN) {
+        if (module_exists('menu_per_role') && !is_null($access = menu_per_role_access($item->mid))) {
+          $_menu['items'][$item->mid]['access'] = isset($_menu['items'][$item->mid]['access']) ? $_menu['items'][$item->mid]['access'] && $access : $access;
+        }
         $_menu['items'][$item->mid]['title'] = $item->title;
         $_menu['items'][$item->mid]['description'] = $item->description;
         $_menu['items'][$item->mid]['pid'] = $item->pid;