WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#23182 closed defect (bug) (fixed)

Offset error if the first item in an admin menu is a separator

Reported by: phill_brown Owned by: markjaquith
Milestone: 3.6 Priority: normal
Severity: normal Version: 2.7
Component: Warnings/Notices Keywords: has-patch
Focuses: Cc:
PR Number:

Description

There are a few ways you can get to this error, but the easiest way with the default install is:

add_action( 'admin_menu', create_function( '', 'unset( $GLOBALS[\'menu\'][2] );' ) );

I originally came across the error assigning the manage_sites capability to a non super admin role. If you do the same and visit /wp-admin/network/sites.php - you'll see the same error.

If this fix is approved, it raises another minor issue with the network page. There's now an unnecessary separator at the top of the menu. The second patch (network-menu) assigns the same capability requirement to the separator as the dashboard.

Attachments (3)

includes-menu.php.patch (450 bytes) - added by phill_brown 7 years ago.
Fixes offset error if separator is first in the admin menu
network-menu.php.patch (652 bytes) - added by phill_brown 7 years ago.
Fixes UI issue showing a non-required separator
23182.patch (1.2 KB) - added by SergeyBiryukov 7 years ago.

Download all attachments as: .zip

Change History (8)

@phill_brown
7 years ago

Fixes offset error if separator is first in the admin menu

@phill_brown
7 years ago

Fixes UI issue showing a non-required separator

#1 @SergeyBiryukov
7 years ago

  • Component changed from Menus to Warnings/Notices
  • Milestone changed from Awaiting Review to 3.6
  • Version changed from trunk to 2.7

Confirmed the notice. The fix looks sane to me.

Refreshed as a single patch with proper file paths in 23182.patch.

#3 @markjaquith
6 years ago

Not going to do the separator permissions thing. I think that's better handled through #24104. We should clean up dupes and trailing/leading separators automatically.

#4 @markjaquith
6 years ago

  • Owner set to markjaquith
  • Resolution set to fixed
  • Status changed from new to closed

In 24455:

Prevent an offset error if the first menu item is a separator.

props phill_brown. fixes #23182

#5 @SergeyBiryukov
6 years ago

#18327 was marked as a duplicate.

Note: See TracTickets for help on using tickets.