After porting my theme to the latest version of zen 7.x-3.x I got this Notice every page:

Notice: Undefined index: in zen_preprocess_page() (line 227 of /local/drupal-7/sites/all/themes/zen/template.php).

The functions code is this, the last line is 227

function zen_preprocess_page(&$variables, $hook) {
// Find the title of the menu used by the secondary links.
$secondary_links = variable_get('menu_secondary_links_source', 'user-menu');
$menus = menu_get_menus();
$variables['secondary_menu_heading'] = $menus[$secondary_links];
}

I found out, that the error only occurs, when I disable the secondary menu under Structure>Menus>Settings
If you can reproduce it, I think this is a major issue.

Comments

I had the same issue (Secondary menu turned off, "Rebuild theme registry on every page" turned off). Tried re-enabling secondary menu, still had warning.

Turned on "Rebuild theme registry on every page", got rid of warning.
Turned rebuild registry off, no warning.
Cleared cache, turned secondary off & on and fiddled with performance settings... no warning.

In fact, after rebuilding the theme registry that once (with the Mar 2nd 7.x-3.x-dev) I have not been able to duplicate this issue.

My take on it is that the theme registry set from the previous 7.x-3.x-dev didn't like whatever changes came down on Mar 2nd.

Try clearing the cache and rebuilding the registry and let us know if you still get that warning.

In my zen sub-theme "rebuild registry on every page" is enabled. Now I tried cleaning the cache but still got that warning.
This error also occurs when I activate the Zen base theme.

Hi,

I was able to reproduce the same isssue on my local site.
And it seems like when we disable the secondary links, $secondary_menu_heading is not set/is empty , so the warning of Undefined index comes up.
I added the following if statements in my template.php and page.tpl.php and it worked for me.
Now I dont get any warning message.

Following are the changes that i have made:

In zen/template.php on line no 227

if(!empty($secondary_links)) {
  $variables['secondary_menu_heading'] = $menus[$secondary_links];
}

And in page.tpl.php

<?php if(!empty($secondary_menu_heading)): ?>  // Added this line
   <?php print theme('links__system_secondary_menu', array(
     
'links' => $secondary_menu,
     
'attributes' => array(
       
'id' => 'secondary-menu',
       
'class' => array('links', 'clearfix'),
      ),
     
'heading' => array(
       
'text' => $secondary_menu_heading,
       
'level' => 'h2',
       
'class' => array('element-invisible'),
      ),
    ));
?>

<?php endif; ?> // Added this line

This fixes the issue.
I am at the very beginning of Git migration and failed to make a patch out of it. I will continue and try later.
If someone is quicker he can also patch this.

Status:Active» Needs review
StatusFileSize
new1.45 KB

Finally got it, but I was not able to push the changes to origin

Hi,

I came across this issue http://drupal.org/node/1085790 . The issue mentioned on this link is similar to this issue.
So the code which i have mentioned above i.e #3 has to be modified a bit so that both the issues are solved.

Here is the code that has to be modified in template.php

if(!empty($secondary_links)) {     // Moved if statement above $menus = menu_get_menus();
  $menus = menu_get_menus();
  $variables['secondary_menu_heading'] = $menus[$secondary_links];
}

Version:7.x-3.x-dev» 7.x-5.x-dev
StatusFileSize
new2.31 KB

Just modified the patch to match your code

Patch worked for me.

Version:7.x-5.x-dev» 7.x-3.x-dev

I have attached the patch and still have the error. I have tried flush the cash, mark second menu as active and not active, rebuild and not rebuild... and no matter what I do, I get the same error...

Notice: Undefined index: menu-submenu in zen_preprocess_page() (line 228 of /var/www/www.domain.com/www/sites/all/themes/zen/template.php).

Please help.
I even tried to replace the ZEN with the older version but that didn't help as it was like Drupel already had seen the new version. I don't know how to uninstall the ZEN theme to correctly replace it with the older, working version.

For deinstallation, you have to deactivate the Theme and set a standard theme as default. Then you might delete the Zen folder in sites/all/themes/

I just installed a clean drupal7 with Zen (Starterkit Theme) and the latest patch from above. I don't get any trouble with this issue, patch works.

Fatal error: Call to undefined function menu_get_menus() will still occur if the core Menu module is disabled
I guess you would need to do it like this

<?php
function zen_preprocess_page(&$variables, $hook) {
 
// Find the title of the menu used by the secondary links.
 
$secondary_links = variable_get('menu_secondary_links_source', 'user-menu');
  if(
function_exists('menu_get_menus') && !empty($secondary_links)) {
   
$menus = menu_get_menus();
   
$variables['secondary_menu_heading'] = $menus[$secondary_links];
  }
}
?>

In my case, I don't get this error when I disable menu.module and use the (patched 7.x-5.x) Zen (Starterkit) on a clean d7 installation

disregard, tried some times, now I get it to. I will try to roll a patch for this

StatusFileSize
new1.54 KB

Code above wrapped in a patch

Can someone tell me if this patch is to be applied to the template.php of your zen theme? That's not working for me.

Title:PHP Error when secondary Menu is disabledPHP Error when secondary menu or menu module is disabled
Status:Needs review» Fixed
StatusFileSize
new735 bytes

The if statement in the page.tpl is unnecessary if we ensure that $secondary_menu_heading gets a value in zen_preprocess_page().

Also, the current patch doesn't quite work if the menu module is disabled while the secondary menu is enabled. The heading for the secondary menu is empty instead of containing the menu's title.

Here's the patch I committed.

Thanks for all your help, everyone! You're in the CHANGELOG now.

Fixed. http://drupalcode.org/project/zen.git/commit/9d330c3

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.