Skip to:
Content

BuddyPress.org

Ticket #4533: 4533.diff

File 4533.diff, 970 bytes (added by jkudish, 13 years ago)

return false if the parent item doesn't exist in bp_core_remove_nav_item() and adjust phpdoc for the function

  • bp-core/bp-core-buddybar.php

     
    373373 * Removes a navigation item from the sub navigation array used in BuddyPress themes.
    374374 *
    375375 * @package BuddyPress Core
    376  * @param $parent_id The id of the parent navigation item.
    377  * @param $slug The slug of the sub navigation item.
     376 * @param int $parent_id The id of the parent navigation item.
     377 * @param bool|string false if the parent item doesn't exist or $slug the slug of the sub navigation item.
    378378 */
    379379function bp_core_remove_nav_item( $parent_id ) {
    380380        global $bp;
     
    386386                }
    387387        }
    388388
     389        if ( empty( $bp->bp_nav[$parent_id] ) )
     390    return false;
     391
    389392        if ( $function = $bp->bp_nav[$parent_id]['screen_function'] ) {
    390393                if ( is_object( $function[0] ) ) {
    391394                        remove_action( 'bp_screens', array( &$function[0], $function[1] ), 3 );