[buddypress-trac] [BuddyPress] #4533: Avoid "Notice: Undefined index" in bp_core_remove_nav_item
buddypress-trac at lists.automattic.com
buddypress-trac at lists.automattic.com
Mon Sep 17 15:00:22 UTC 2012
#4533: Avoid "Notice: Undefined index" in bp_core_remove_nav_item
--------------------------+-----------------------------
Reporter: wpdennis | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Core | Version:
Severity: trivial | Keywords: dev-feedback
--------------------------+-----------------------------
I added an action to "bp_setup_nav" to remove nav items like:
{{{
bp_core_remove_nav_item('blogs');
bp_core_remove_nav_item('forums');
}}}
This can result in "Notice: Undefined index" in line 389
http://buddypress.trac.wordpress.org/browser/trunk/bp-core/bp-core-
buddybar.php#L389.
Maybe we could avoid this in bp_core_remove_nav_item by adding:
{{{
if (!isset($bp->bp_nav[$parent_id]))
return;
}}}
just before this if statement:
{{{
if ( $function = $bp->bp_nav[$parent_id]['screen_function'] ) {
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4533>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list