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.

bbPress::setup_globals()

Set some smart defaults to class variables. Allow some of them to be filtered to allow for early overriding.

Description

Source

File: bp-forums/classes/class-bbpress.php

186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
private function setup_globals() {
 
    /** Versions **********************************************************/
 
    $this->version    = '2.5.14-6684';
    $this->db_version = '250';
 
    /** Paths *************************************************************/
 
    // Setup some base path and URL information
    $this->file       = __FILE__;
    $this->basename   = apply_filters( 'bbp_plugin_basename', plugin_basename( buddypress()->file ) );
    $this->plugin_dir = apply_filters( 'bbp_plugin_dir_path', buddypress()->plugin_dir . 'bp-forums/' );
    $this->plugin_url = apply_filters( 'bbp_plugin_dir_url',  buddypress()->plugin_url . 'bp-forums/' );
 
    // Includes
    $this->includes_dir = apply_filters( 'bbp_includes_dir', trailingslashit( $this->plugin_dir ) );
    $this->includes_url = apply_filters( 'bbp_includes_url', trailingslashit( $this->plugin_url ) );
 
    // Templates
    $this->themes_dir   = apply_filters( 'bbp_themes_dir',   trailingslashit( $this->plugin_dir . 'templates' ) );
    $this->themes_url   = apply_filters( 'bbp_themes_url',   trailingslashit( $this->plugin_url . 'templates' ) );
 
    /** Identifiers *******************************************************/
 
    // Post type identifiers
    $this->forum_post_type   = apply_filters( 'bbp_forum_post_type''forum'     );
    $this->topic_post_type   = apply_filters( 'bbp_topic_post_type''topic'     );
    $this->reply_post_type   = apply_filters( 'bbp_reply_post_type''reply'     );
    $this->topic_tag_tax_id  = apply_filters( 'bbp_topic_tag_tax_id', 'topic-tag' );
 
    // Status identifiers
    $this->spam_status_id    = apply_filters( 'bbp_spam_post_status',    'spam'    );
    $this->closed_status_id  = apply_filters( 'bbp_closed_post_status''closed'  );
    $this->orphan_status_id  = apply_filters( 'bbp_orphan_post_status''orphan'  );
    $this->public_status_id  = apply_filters( 'bbp_public_post_status''publish' );
    $this->pending_status_id = apply_filters( 'bbp_pending_post_status', 'pending' );
    $this->private_status_id = apply_filters( 'bbp_private_post_status', 'private' );
    $this->hidden_status_id  = apply_filters( 'bbp_hidden_post_status''hidden'  );
    $this->trash_status_id   = apply_filters( 'bbp_trash_post_status',   'trash'   );
 
    // Other identifiers
    $this->user_id           = apply_filters( 'bbp_user_id',   'bbp_user'   );
    $this->tops_id           = apply_filters( 'bbp_tops_id',   'bbp_tops'   );
    $this->reps_id           = apply_filters( 'bbp_reps_id',   'bbp_reps'   );
    $this->favs_id           = apply_filters( 'bbp_favs_id',   'bbp_favs'   );
    $this->subs_id           = apply_filters( 'bbp_subs_id',   'bbp_subs'   );
    $this->view_id           = apply_filters( 'bbp_view_id',   'bbp_view'   );
    $this->edit_id           = apply_filters( 'bbp_edit_id',   'edit'       );
    $this->paged_id          = apply_filters( 'bbp_paged_id''paged'      );
    $this->search_id         = apply_filters( 'bbp_search_id', 'bbp_search' );
 
    /** Queries ***********************************************************/
 
    $this->current_view_id      = 0; // Current view id
    $this->current_forum_id     = 0; // Current forum id
    $this->current_topic_id     = 0; // Current topic id
    $this->current_reply_id     = 0; // Current reply id
    $this->current_topic_tag_id = 0; // Current topic tag id
 
    $this->forum_query    = new WP_Query(); // Main forum query
    $this->topic_query    = new WP_Query(); // Main topic query
    $this->reply_query    = new WP_Query(); // Main reply query
    $this->search_query   = new WP_Query(); // Main search query
 
    /** Theme Compat ******************************************************/
 
    $this->theme_compat   = new stdClass(); // Base theme compatibility class
    $this->filters        = new stdClass(); // Used when adding/removing filters
 
    /** Users *************************************************************/
 
    $this->current_user   = new WP_User(); // Currently logged in user
    $this->displayed_user = new WP_User(); // Currently displayed user
 
    /** Misc **************************************************************/
 
    $this->domain         = 'bbpress';      // Unique identifier for retrieving translated strings
    $this->extend         = new stdClass(); // Plugins add data here
    $this->errors         = new WP_Error(); // Feedback
    $this->tab_index      = apply_filters( 'bbp_default_tab_index', 100 );
}

Changelog

Changelog
Version Description
bbPress (r2626) 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.