BP_Media_Component::setup_globals( array $args = array() )

Set up component global data.

Description

See also

Parameters

$args

(Optional) See BP_Component::setup_globals() for a description.

Default value: array()

Source

File: bp-media/classes/class-bp-media-component.php

153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
    public function setup_globals( $args = array() ) {
        $bp = buddypress();
 
        // Define a slug, if necessary.
        if ( ! defined( 'BP_MEDIA_SLUG' ) ) {
            define( 'BP_MEDIA_SLUG', $this->id );
        }
 
        // Global tables for media component.
        $global_tables = array(
            'table_name'        => $bp->table_prefix . 'bp_media',
            'table_name_albums' => $bp->table_prefix . 'bp_media_albums',
        );
 
        // Fetch the default directory title.
        $default_directory_titles = bp_core_get_directory_page_default_titles();
        $default_directory_title  = $default_directory_titles[$this->id];
 
        // All globals for media component.
        // Note that global_tables is included in this array.
        parent::setup_globals( array(
            'slug'                  => 'photos',
            'root_slug'             => isset( $bp->pages->media->slug ) ? $bp->pages->media->slug : BP_MEDIA_SLUG,
            'has_directory'         => true,
//          'notification_callback' => 'bp_media_format_notifications',
            'global_tables'         => $global_tables,
            'directory_title'       => isset( $bp->pages->media->title ) ? $bp->pages->media->title : $default_directory_title,
            'search_string'         => __( 'Search Photos…', 'buddyboss' ),
        ) );
 
        /* Single Album Globals **********************************************/
 
        // Are we viewing a single album?
        if ( bp_is_media_component() && bp_is_single_album()
             && ( $album_id = BP_Media_Album::album_exists( bp_action_variable( 0 ) ) )
        ) {
            $bp->is_single_item  = true;
            $this->current_album = albums_get_album( $album_id );
 
            // Set current_album to 0 to prevent debug errors.
        } else {
            $this->current_album = 0;
        }
 
    }

Changelog

Changelog
Version Description
BuddyBoss 1.0.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.