BP_Core_BP_Nav_BackCompat::offsetSet( mixed $offset, array $value )

Assign a value to the nav array at the specified offset.

Description

Parameters

$offset

(Required) Array offset.

$value

(Required) Nav item.

Source

File: bp-core/classes/class-bp-core-bp-nav-backcompat.php

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
public function offsetSet( $offset, $value ) {
    _doing_it_wrong(
        'bp_nav',
        __( 'The bp_nav and bp_options_nav globals should not be used directly and are deprecated. Please use the BuddyPress nav functions instead.', 'buddyboss' ),
        '2.6.0'
    );
 
    $bp = buddypress();
 
    if ( is_array( $value ) ) {
        $value = new self( $value );
    }
 
    if ( $offset !== null ) {
        // Temporarily set the backcompat_nav.
        $this->backcompat_nav[ $offset ] = $value;
 
        $args = $this->to_array();
        if ( isset( $args['parent_slug'] ) ) {
            $this->get_component_nav( $args['parent_slug'] )->edit_nav( $args, $args['slug'], $args['parent_slug'] );
        } elseif ( isset( $args['slug'] ) ) {
            $bp->members->nav->edit_nav( $args, $args['slug'] );
        }
    }
}

Changelog

Changelog
Version Description
BuddyPress 2.6.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.