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
58 59 60 61 62 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 88 89 90 91 | 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.