Skip to:
Content

BuddyPress.org

Changeset 12332


Ignore:
Timestamp:
02/02/2019 05:49:14 PM (6 years ago)
Author:
espellcaste
Message:

Casting the $primary_nav_item variable to an array when fetching the nav primary item to avoid PHP warning.

The get_primary method returns false when there is no nav primary item assigned. The false value returned triggered PHP warning when trying to get the first value of the array with reset.

Props imath, klawton

Fixes #8005

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-template.php

    r12281 r12332  
    30313031
    30323032        if ( ! empty( $bp->members->nav ) ) {
    3033             $primary_nav_item = $bp->members->nav->get_primary( array( 'slug' => $component_id ), false );
     3033            $primary_nav_item = (array) $bp->members->nav->get_primary( array( 'slug' => $component_id ), false );
    30343034            $primary_nav_item = reset( $primary_nav_item );
    30353035        }
Note: See TracChangeset for help on using the changeset viewer.