Hi,

I am using the development version of admin menu because as per my client requirement "add content" section should also appear.
Everything works fine except single issue that I m getting an error message in the admin menu code, when any user logged in at the website i.e.
Notice: Undefined index: admin/config in admin_menu_admin_menu_output_build() (line 486 of //sites/all/modules/contrib/admin_menu/admin_menu

Can anybody suggest me a solution to troubleshoot this issue.

Thanks in advance.

Poorva,

Comments

patoshi’s picture

same issue here.

Xomby’s picture

I had the same issue.
line 486 of admin_menu\admin_menu.module reads:

unset($content['menu']['admin/config'][$key]['#weight']);

While just commenting it out resolves the error message, I can't verify (as I didn't write any of the code for this module) whether this variable SHOULD exist, or DID exist (and this is just legacy code), or MIGHT exist at some point in the future... so...
I modified this line to include a check to see if the index DOES exist, and if it does, then it can unset the index as normal... if it DOESN'T exist... it just ignores the unset statement, effectively both resolving the issue and not breaking something else if this index exists in your setup.

Very simply, replace line 486 with the following:

if(isset($content['menu']['admin/config'][$key]['#weight'])){
   unset($content['menu']['admin/config'][$key]['#weight']);
}

Note - I'm a little surprised that this check wasn't there to begin with, considering it seems like a fairly specific unset statement... almost like it was a hack to get something else working (during development)...

Xomby’s picture

Status: Active » Needs review
sun’s picture

Title: Undefined index related error » PHP Notice: Undefined index: 'admin/config' in admin_menu_admin_menu_output_build()
Status: Needs review » Fixed

That's indeed some sloppy code there - sorry for that.

Thanks for reporting, reviewing, and testing! Fixed in all 3.x branches.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

matulis’s picture

Notice still there, 7.x-3.0-rc2

matulis’s picture

Status: Fixed » Needs review

admin_menu.module, line 486

-  if ($content['menu']['admin/config']) {
+  if (!empty($content['menu']['admin/config'])) {
sun’s picture

Status: Needs review » Fixed

Yes, I'm sorry, I wasn't aware of this patch before doing the RC2 release.

This fix is contained in the development snapshot and will be part of the next release (either RC3 or a stable 3.0).

kle’s picture

Thank you for that !

Xomby’s picture

Glad I could help! I <3 admin_menu -- and through a bit of tweaking (to hide things I don't want my user-admin's to see) so do my customers!

jimi’s picture

Similar problem in the RC3 but in menu/menu.module
Notice : Undefined index: admin_menu in menu_block_view() (line 486 in //modules/menu/menu.module).
line486 -> $data['subject'] = check_plain($menus[$delta]);
??

sun’s picture

@jimi: That should have been a separate issue. Did you run update.php?

jimi’s picture

yes for sure, empty caches…
Sory, its not admin menu (disabled: same problem)

Status: Fixed » Closed (fixed)

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