Notice: Undefined variable: parent_depth in theme_nice_menus_tree() (line 399 of sites/all/modules/nice_menus/nice_menus.module).

The notice occurs when the in block settings for the nice menu the depth is set to anything higher than zero.

Looking at the code, it appears that $parent_depth is set on line 376, but that's inside an IF statement, so it's not always called.

Using PHP 5.2.17

Comments

wvlgen’s picture

I have the same problem, but -1 seems to do the jog.

wid’s picture

Priority: Minor » Normal
Status: Active » Patch (to be ported)

Adding parent_depth = 0 does the trick

 // Allow i18n module to translate strings where available.
  if (module_exists('i18nmenu')) {
    i18nmenu_localize_tree($menu);
  }

  // Assume depth == 0 by default, overriden if mlid is specified (http://drupal.org/node/1101722)
  $parent_depth = 0;
  // For custom $menus and menus built all the way from the top-level we 
  // don't need to "create" the specific sub-menu and we need to get the title
  // from the $menu_name since there is no "parent item" array.
  
  // Create the specific menu if we have a mlid.
  if (!empty($mlid)) { 
    // Load the parent menu item.
vordude’s picture

Status: Patch (to be ported) » Active

No patch here yet, it looks like a small fix.

Anonymous’s picture

Same here, it's PHP5.3+ issue.

dalin’s picture

Status: Active » Needs review
StatusFileSize
new548 bytes
hswong3i’s picture

Version: 7.x-2.0-beta2 » 7.x-2.x-dev
Status: Needs review » Reviewed & tested by the community
Issue tags: +php5.3

Subscribe. Patch from #5 works for me, thank you very much ;-)

mark trapp’s picture

Subscribe. Seconding RTBC for #5.

amateescu’s picture

Issue tags: -php5.3

The patch from #5 looks good to me too.

nikkubhai’s picture

Have you commited the patch?

vordude’s picture

Status: Reviewed & tested by the community » Fixed

committed with 3c8fdcd2799486c

Status: Fixed » Closed (fixed)

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

sranith73’s picture

I added the patch provided. But still getting other error like below
Notice: Undefined variable: title in theme_nice_menus_tree() of nice_menus.module

I am using 7.x-2.5 version of nice menus.

Suggest me something to get rid of this error

xiukun.zhou’s picture

Issue summary: View changes
Status: Closed (fixed) » Active
StatusFileSize
new1.19 KB

Hi sranith73.
try patch

sranith73’s picture

Thanks xiukun, Adding the patch worked for me

jenlampton’s picture

Status: Active » Closed (fixed)

this fix was committed, so closing the issue.