BP_Blogs_Component::late_includes()

Late includes method.

Description

Only load up certain code when on specific pages.

Source

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

151
152
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
public function late_includes() {
    // Bail if PHPUnit is running.
    if ( defined( 'BP_TESTS_DIR' ) ) {
        return;
    }
 
    // Bail if not on a blogs page or not multisite.
    if ( ! bp_is_blogs_component() || ! is_multisite() ) {
        return;
    }
 
    // Actions.
    if ( isset( $_GET['random-blog'] ) ) {
        require $this->path . 'bp-blogs/actions/random.php';
    }
 
    // Screens.
    if ( bp_is_user() ) {
        require $this->path . 'bp-blogs/screens/my-blogs.php';
    } else {
        if ( bp_is_blogs_directory() ) {
            require $this->path . 'bp-blogs/screens/directory.php';
        }
 
        if ( is_user_logged_in() && bp_is_current_action( 'create' ) ) {
            require $this->path . 'bp-blogs/screens/create.php';
        }
 
        // Theme compatibility.
        new BP_Blogs_Theme_Compat();
    }
}

Changelog

Changelog
Version Description
BuddyPress 3.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.