BP_XProfile_Component::late_includes()

Late includes method.

Description

Only load up certain code when on specific pages.

Source

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

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
public function late_includes() {
    // Bail if PHPUnit is running.
    if ( defined( 'BP_TESTS_DIR' ) ) {
        return;
    }
 
    // Bail if not on a user page.
    if ( ! bp_is_user() ) {
        return;
    }
 
    // User nav.
    if ( bp_is_profile_component() ) {
        require $this->path . 'bp-xprofile/screens/public.php';
 
        // Action - Delete avatar.
        if ( is_user_logged_in()&& bp_is_user_change_avatar() && bp_is_action_variable( 'delete-avatar', 0 ) ) {
            require $this->path . 'bp-xprofile/actions/delete-avatar.php';
        }
 
        // Sub-nav items.
        if ( is_user_logged_in() &&
            in_array( bp_current_action(), array( 'edit', 'change-avatar', 'change-cover-image' ), true )
        ) {
            require $this->path . 'bp-xprofile/screens/' . bp_current_action() . '.php';
        }
    }
 
    // Settings.
    if ( is_user_logged_in() && bp_is_user_settings_profile() ) {
        require $this->path . 'bp-xprofile/screens/settings-profile.php';
    }
}

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.