BP_Settings_Component::late_includes()
Late includes method.
Description
Only load up certain code when on specific pages.
Source
File: bp-settings/classes/class-bp-settings-component.php
public function late_includes() { // Bail if PHPUnit is running. if ( defined( 'BP_TESTS_DIR' ) ) { return; } // Bail if not on Settings component. if ( ! bp_is_settings_component() ) { return; } $actions = array( 'notifications', 'capabilities', 'delete-account', 'export' ); // Authenticated actions. if ( is_user_logged_in() ) { if ( ! bp_current_action() || bp_is_current_action( 'general' ) ) { require $this->path . 'bp-settings/actions/general.php'; // Specific to post requests. } elseif ( bp_is_post_request() && in_array( bp_current_action(), $actions, true ) ) { require $this->path . 'bp-settings/actions/' . bp_current_action() . '.php'; } } // Screens - User profile integration. if ( bp_is_user() ) { require $this->path . 'bp-settings/screens/general.php'; // Sub-nav items. if ( in_array( bp_current_action(), $actions, true ) ) { require $this->path . 'bp-settings/screens/' . bp_current_action() . '.php'; } } }
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.