Skip to:
Content

BuddyPress.org

Changeset 3947


Ignore:
Timestamp:
01/27/2011 06:42:12 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Move $bp_pages global into $bp->pages global. Check empty() on table_prefix, root_domain, and site_options to allow manual overrides.

Location:
trunk/bp-core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-catchuri.php

    r3917 r3947  
    2727 */
    2828function bp_core_set_uri_globals() {
    29     global $bp, $bp_pages;
    30     global $bp_unfiltered_uri, $bp_unfiltered_uri_offset;
     29    global $bp, $bp_unfiltered_uri, $bp_unfiltered_uri_offset;
    3130    global $current_blog;
    3231
     
    4342
    4443    // Fetch all the WP page names for each component
    45     if ( empty( $bp_pages ) )
    46         $bp_pages = bp_core_get_page_names();
     44    if ( empty( $bp->pages ) )
     45        $bp->pages = bp_core_get_page_names();
    4746
    4847    // Ajax or not?
     
    119118
    120119    // Find a match within registered BuddyPress controlled WP pages (check members first)
    121     foreach ( (array)$bp_pages as $page_key => $bp_page ) {
     120    foreach ( (array)$bp->pages as $page_key => $bp_page ) {
    122121        if ( in_array( $bp_page->name, (array)$bp_uri ) ) {
    123122            // Match found, now match the slug to make sure.
  • trunk/bp-core/bp-core-loader.php

    r3944 r3947  
    3535
    3636    function _setup_globals() {
    37         global $bp, $bp_pages;
     37        global $bp;
     38
     39        /** Database **********************************************************/
    3840
    3941        // Get the base database prefix
    40         $bp->table_prefix = bp_core_get_table_prefix();
     42        if ( empty( $bp->table_prefix ) )
     43            $bp->table_prefix = bp_core_get_table_prefix();
    4144
    4245        // The domain for the root of the site where the main blog resides
    43         $bp->root_domain  = bp_core_get_root_domain();
     46        if ( empty( $bp->root_domain ) )
     47            $bp->root_domain = bp_core_get_root_domain();
     48
     49        // Fetches all of the core BuddyPress settings in one fell swoop
     50        if ( empty( $bp->site_options ) )
     51            $bp->site_options = bp_core_get_site_options();
    4452
    4553        // The names of the core WordPress pages used to display BuddyPress content
    46         $bp->pages        = $bp_pages;
     54        if ( empty( $bp->pages ) )
     55            $bp->pages = bp_core_get_page_names();
    4756
    48         /** Component and Action **************************************************/
     57        /** Component and Action **********************************************/
    4958
    5059        // Used for overriding the 2nd level navigation menu so it can be used to
     
    6372        }
    6473
    65         // Fetches all of the core BuddyPress settings in one fell swoop
    66         $bp->site_options = bp_core_get_site_options();
    67 
    6874        // Sets up the array container for the component navigation rendered
    6975        // by bp_get_nav()
     
    7884        $bp->active_components = array();
    7985
    80         /** Basic current user data ***********************************************/
     86        /** Basic current user data *******************************************/
    8187
    8288        // Logged in user is the 'current_user'
     
    8692        $bp->loggedin_user->id   = $current_user->ID;
    8793
    88         /** Avatars ***************************************************************/
     94        /** Avatars ***********************************************************/
    8995
    9096        // Fetches the default Gravatar image to use if the user/group/blog has no avatar or gravatar
  • trunk/bp-core/bp-core-wpabstraction.php

    r3859 r3947  
    1414 */
    1515if ( !is_multisite() ) {
     16    global $wpdb;
     17
    1618    $wpdb->base_prefix = $wpdb->prefix;
    1719    $wpdb->blogid      = 1;
  • trunk/bp-core/deprecated/1.3.php

    r3917 r3947  
    301301 */
    302302function bp_core_add_root_component( $slug ) {
    303     global $bp, $bp_pages;
     303    global $bp;
    304304
    305305    _deprecated_function( __FUNCTION__, '1.3', 'wp_insert_post()' );
    306     if ( empty( $bp_pages ) )
    307         $bp_pages = bp_core_get_page_names();
     306    if ( empty( $bp->pages ) )
     307        $bp->pages = bp_core_get_page_names();
    308308
    309309    $match = false;
    310310
    311311    // Check if the slug is registered in the $bp->pages global
    312     foreach ( (array)$bp_pages as $key => $page ) {
     312    foreach ( (array)$bp->pages as $key => $page ) {
    313313        if ( $key == $slug || $page->slug == $slug )
    314314            $match = true;
Note: See TracChangeset for help on using the changeset viewer.