After upgrade from 1.3 to 2, I started getting a PHP error and no Nice Menu being rendered.

call_user_func_array() expects parameter 1 to be a valid callback, function 'theme_nice_menu_primary_links' not found or invalid function name in /srv/www//public_html/includes/theme.inc on line 668.

The reason it is throwing this error is because I was calling the menu system with this function. It was working previously but now with 6.2 it is no longer working.

theme('nice_menu_primary_links');

What is the way to call this in 6.2? This didn't seem to be documented or stand out anywhere when I read the upgrade notes. Please advise. Thanks!

Comments

jusdavi’s picture

Correction. I updated to 6.2.1 NOT 6.2.

jusdavi’s picture

Title: Update 6.1.3 to 6.2. Now getting PHP Error » Update 6.1.3 to 6.2.1 Now getting PHP Error
gohlkus’s picture

Status: Closed (fixed) » Active

From UPGRADE.txt:

THEME FUNCTIONS:
The theme functions have all been RENAMED to be more in line with Drupal standards, so if you are overwriting the functions in your theme's template.php or calling the functions anywhere in your theme, you should update the function names. The old functions were called theme_nice_menu_* and the new ones are theme_nice_menus_*, with an "s" to match the module name.

I am getting this same error and am having trouble figuring out where the developers called the function. Any help would be appreciated.

scottsawyer’s picture

@gohlkus, thanks for this, exactly my problem. So, in my situation, I had a theme function in my theme's template.php:

 function THEMENAME_nice_menu_primary_links($direction = 'down', $menu = NULL) {
  $pid = variable_get('menu_primary_menu', 0);
  $output = theme('nice_menu', 'primary', $pid, $direction, $menu);
  return $output['content'];
}

and in my page.tpl.php:

  print theme_nice_menu_primary_links($primary_links);

This caused my error. So, following your post, I change in my page.tpl.php:

  print theme_nice_menus_primary_links($primary_links);

and template.php:

 function THEMENAME_nice_menus_primary_links($direction = 'down', $menu = NULL) {
  $pid = variable_get('menu_primary_menu', 0);
  $output = theme('nice_menu', 'primary', $pid, $direction, $menu);
  return $output['content'];
}

Notice the addition of "s" in the function names appended to "menu". Re-uploaded to the site, refresh, happy days!

steinmb’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

Status: Active » Closed (fixed)