Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

BP_Core::bootstrap()

Populate the global data needed before BuddyPress can continue.


Description Description

This involves figuring out the currently required, activated, deactivated, and optional components.


Source Source

File: bp-core/classes/class-bp-core.php

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
private function bootstrap() {
    $bp = buddypress();
 
    /**
     * Fires before the loading of individual components and after BuddyPress Core.
     *
     * Allows plugins to run code ahead of the other components.
     *
     * @since 1.2.0
     */
    do_action( 'bp_core_loaded' );
 
    /** Components *******************************************************
     */
 
    /**
     * Filters the included and optional components.
     *
     * @since 1.5.0
     *
     * @param array $value Array of included and optional components.
     */
    $bp->optional_components = apply_filters( 'bp_optional_components', array( 'activity', 'blogs', 'friends', 'groups', 'messages', 'notifications', 'settings', 'xprofile' ) );
 
    /**
     * Filters the required components.
     *
     * @since 1.5.0
     *
     * @param array $value Array of required components.
     */
    $bp->required_components = apply_filters( 'bp_required_components', array( 'members' ) );
 
    // Get a list of activated components.
    if ( $active_components = bp_get_option( 'bp-active-components' ) ) {
 
        /** This filter is documented in bp-core/admin/bp-core-admin-components.php */
        $bp->active_components      = apply_filters( 'bp_active_components', $active_components );
 
        /**
         * Filters the deactivated components.
         *
         * @since 1.0.0
         *
         * @param array $value Array of deactivated components.
         */
        $bp->deactivated_components = apply_filters( 'bp_deactivated_components', array_values( array_diff( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), array_keys( $bp->active_components ) ) ) );
 
    // Pre 1.5 Backwards compatibility.
    } elseif ( $deactivated_components = bp_get_option( 'bp-deactivated-components' ) ) {
 
        // Trim off namespace and filename.
        foreach ( array_keys( (array) $deactivated_components ) as $component ) {
            $trimmed[] = str_replace( '.php', '', str_replace( 'bp-', '', $component ) );
        }
 
        /** This filter is documented in bp-core/bp-core-loader.php */
        $bp->deactivated_components = apply_filters( 'bp_deactivated_components', $trimmed );
 
        // Setup the active components.
        $active_components     = array_fill_keys( array_diff( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), array_values( $bp->deactivated_components ) ), '1' );
 
        /** This filter is documented in bp-core/admin/bp-core-admin-components.php */
        $bp->active_components = apply_filters( 'bp_active_components', $bp->active_components );
 
    // Default to all components active.
    } else {
 
        // Set globals.
        $bp->deactivated_components = array();
 
        // Setup the active components.
        $active_components     = array_fill_keys( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), '1' );
 
        /** This filter is documented in bp-core/admin/bp-core-admin-components.php */
        $bp->active_components = apply_filters( 'bp_active_components', $bp->active_components );
    }
 
    // Loop through optional components.
    foreach( $bp->optional_components as $component ) {
        if ( bp_is_active( $component ) && file_exists( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' ) ) {
            include( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' );
        }
    }
 
    // Loop through required components.
    foreach( $bp->required_components as $component ) {
        if ( file_exists( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' ) ) {
            include( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' );
        }
    }
 
    // Add Core to required components.
    $bp->required_components[] = 'core';
 
    /**
     * Fires after the loading of individual components.
     *
     * @since 2.0.0
     */
    do_action( 'bp_core_components_included' );
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.