Skip to:
Content

BuddyPress.org

Changeset 4602


Ignore:
Timestamp:
07/04/2011 04:59:01 PM (13 years ago)
Author:
johnjamesjacoby
Message:
  • Swap BP_ROOT_BLOG const usage for new bp_get_root_blog_id() function
  • Use bp_get_root_blog_id() place of bp_get_option_blog_id()
  • Check for BP_ENABLE_MULTIBLOG when assigning root blog ID

See #3313, #3314.

Location:
trunk
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-notifications.php

    r4558 r4602  
    4747            $ud       = bp_core_get_core_userdata( $receiver_user_id );
    4848            $to       = $ud->user_email;
    49             $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     49            $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES );
    5050            $subject  = '[' . $sitename . '] ' . sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name );
    5151
     
    9393        $ud       = bp_core_get_core_userdata( $original_activity->user_id );
    9494        $to       = $ud->user_email;
    95         $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     95        $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES );
    9696        $subject = '[' . $sitename . '] ' . sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name );
    9797
     
    135135        $ud       = bp_core_get_core_userdata( $parent_comment->user_id );
    136136        $to       = $ud->user_email;
    137         $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     137        $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES );
    138138        $subject = '[' . $sitename . '] ' . sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name );
    139139
  • trunk/bp-blogs/bp-blogs-functions.php

    r4596 r4602  
    292292        $blog_id = $wpdb->blogid;
    293293    else
    294         $blog_id = BP_ROOT_BLOG;
     294        $blog_id = bp_get_root_blog_id();
    295295
    296296    if ( empty( $role ) ) {
  • trunk/bp-blogs/bp-blogs-widgets.php

    r4466 r4602  
    99    global $wpdb, $bp;
    1010
    11     if ( bp_is_active( 'activity' ) && (int)$wpdb->blogid == BP_ROOT_BLOG )
     11    if ( bp_is_active( 'activity' ) && (int)$wpdb->blogid == bp_get_root_blog_id() )
    1212        add_action('widgets_init', create_function('', 'return register_widget("BP_Blogs_Recent_Posts_Widget");') );
    1313}
  • trunk/bp-core/admin/bp-core-update.php

    r4559 r4602  
    777777                $active_components['blogs'] = 1;
    778778
    779                 // Make sure that the pages are created on the BP_ROOT_BLOG, no matter which Dashboard the setup is being run on
    780                 if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != BP_ROOT_BLOG ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) )
    781                     switch_to_blog( BP_ROOT_BLOG );
     779                // Make sure that the pages are created on the bp_get_root_blog_id(), no matter which Dashboard the setup is being run on
     780                if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != bp_get_root_blog_id() ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) )
     781                    switch_to_blog( bp_get_root_blog_id() );
    782782
    783783                // Move bp-pages data from the blog options table to site options
     
    789789                bp_update_option( 'bp-pages', $existing_pages );
    790790
    791                 if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != BP_ROOT_BLOG ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) )
     791                if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != bp_get_root_blog_id() ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) )
    792792                    restore_current_blog();
    793793
     
    831831            check_admin_referer( 'bpwizard_pages' );
    832832
    833             // Make sure that the pages are created on the BP_ROOT_BLOG, no matter which Dashboard the setup is being run on
    834             if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != BP_ROOT_BLOG ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) )
    835                 switch_to_blog( BP_ROOT_BLOG );
     833            // Make sure that the pages are created on the bp_get_root_blog_id(), no matter which Dashboard the setup is being run on
     834            if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != bp_get_root_blog_id() ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) )
     835                switch_to_blog( bp_get_root_blog_id() );
    836836
    837837            // Delete any existing pages
     
    844844            bp_update_option( 'bp-pages', $blog_pages );
    845845
    846             if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != BP_ROOT_BLOG ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) )
     846            if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != bp_get_root_blog_id() ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) )
    847847                restore_current_blog();
    848848
     
    958958            check_admin_referer( 'bpwizard_theme' );
    959959
    960             if ( is_multisite() && BP_ROOT_BLOG != get_current_blog_id() )
    961                 switch_to_blog( BP_ROOT_BLOG );
     960            if ( is_multisite() && bp_get_root_blog_id() != get_current_blog_id() )
     961                switch_to_blog( bp_get_root_blog_id() );
    962962
    963963            switch ( $_POST['theme'] ) {
  • trunk/bp-core/bp-core-adminbar.php

    r4586 r4602  
    5757    $wp_admin_bar->add_menu( array(
    5858        'id'    => 'bp-root-blog',
    59         'title' => get_blog_option( BP_ROOT_BLOG, 'blogname' ),
     59        'title' => get_blog_option( bp_get_root_blog_id(), 'blogname' ),
    6060        'href'  => bp_get_root_domain()
    6161    ) );
     
    7272                'parent' => 'bp-root-blog',
    7373                'title' => __( 'Admin Dashboard', 'buddypress' ),
    74                 'href' => get_admin_url( BP_ROOT_BLOG )
     74                'href' => get_admin_url( bp_get_root_blog_id() )
    7575            ) );
    7676
  • trunk/bp-core/bp-core-avatars.php

    r4462 r4602  
    642642
    643643        // If multisite, and current blog does not match root blog, make adjustments
    644         if ( is_multisite() && BP_ROOT_BLOG != get_current_blog_id() )
    645             $basedir = get_blog_option( BP_ROOT_BLOG, 'upload_path' );
     644        if ( is_multisite() && bp_get_root_blog_id() != get_current_blog_id() )
     645            $basedir = get_blog_option( bp_get_root_blog_id(), 'upload_path' );
    646646    }
    647647
     
    669669
    670670        // If multisite, and current blog does not match root blog, make adjustments
    671         if ( is_multisite() && BP_ROOT_BLOG != get_current_blog_id() )
    672             $baseurl = trailingslashit( get_blog_option( BP_ROOT_BLOG, 'home' ) ) . get_blog_option( BP_ROOT_BLOG, 'upload_path' );
     671        if ( is_multisite() && bp_get_root_blog_id() != get_current_blog_id() )
     672            $baseurl = trailingslashit( get_blog_option( bp_get_root_blog_id(), 'home' ) ) . get_blog_option( bp_get_root_blog_id(), 'upload_path' );
    673673    }
    674674
  • trunk/bp-core/bp-core-buddybar.php

    r4600 r4602  
    379379    global $bp;
    380380
    381     echo '<a href="' . bp_get_root_domain() . '" id="admin-bar-logo">' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '</a>';
     381    echo '<a href="' . bp_get_root_domain() . '" id="admin-bar-logo">' . get_blog_option( bp_get_root_blog_id(), 'blogname' ) . '</a>';
    382382}
    383383
  • trunk/bp-core/bp-core-catchuri.php

    r4584 r4602  
    3737    // on multiple blogs
    3838    if ( !defined( 'BP_ENABLE_MULTIBLOG' ) && is_multisite() ) {
    39         if ( BP_ROOT_BLOG != (int) $wpdb->blogid )
     39        if ( bp_get_root_blog_id() != (int) $wpdb->blogid )
    4040            return false;
    4141    }
     
    6767
    6868    // Running off blog other than root
    69     if ( is_multisite() && !is_subdomain_install() && ( defined( 'BP_ENABLE_MULTIBLOG' ) || 1 != BP_ROOT_BLOG ) ) {
     69    if ( is_multisite() && !is_subdomain_install() && ( defined( 'BP_ENABLE_MULTIBLOG' ) || 1 != bp_get_root_blog_id() ) ) {
    7070
    7171        // Any subdirectory names must be removed from $bp_uri.
  • trunk/bp-core/bp-core-cssjs.php

    r4141 r4602  
    3535    global $wpdb;
    3636
    37     if ( is_multisite() && $wpdb->blogid != BP_ROOT_BLOG )
     37    if ( is_multisite() && $wpdb->blogid != bp_get_root_blog_id() )
    3838        return false;
    3939
  • trunk/bp-core/bp-core-filters.php

    r4596 r4602  
    3636 */
    3737function bp_core_email_from_name_filter() {
    38     return apply_filters( 'bp_core_email_from_name_filter', wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES ) );
     38    return apply_filters( 'bp_core_email_from_name_filter', wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES ) );
    3939}
    4040add_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' );
     
    7272        return $themes;
    7373
    74     if ( $wpdb->blogid == BP_ROOT_BLOG ) {
     74    if ( $wpdb->blogid == bp_get_root_blog_id() ) {
    7575        $themes['bp-default'] = 1;
    7676    }
     
    127127    global $bp, $wpdb;
    128128
    129     if ( is_multisite() && $wpdb->blogid != BP_ROOT_BLOG )
     129    if ( is_multisite() && $wpdb->blogid != bp_get_root_blog_id() )
    130130        return $redirect_to;
    131131
  • trunk/bp-core/bp-core-functions.php

    r4596 r4602  
    1212 * @since 1.3
    1313 *
    14  * @uses bp_get_option_blog_id()
     14 * @uses bp_get_root_blog_id()
    1515 * @param str $option_name The option to be retrieved
    1616 * @param str $default Optional. Default value to be returned if the option isn't set
     
    1818 */
    1919function bp_get_option( $option_name, $default = '' ) {
    20     $value = get_blog_option( bp_get_option_blog_id( $option_name ), $option_name, $default );
     20    $value = get_blog_option( bp_get_root_blog_id(), $option_name, $default );
    2121   
    2222    return apply_filters( 'bp_get_option', $value );
     
    3232 * @since 1.3
    3333 *
    34  * @uses bp_get_option_blog_id()
     34 * @uses bp_get_root_blog_id()
    3535 * @param str $option_name The option key to be set
    3636 * @param str $value The value to be set
    3737 */
    3838function bp_update_option( $option_name, $value ) {
    39     // update_blog_option() does not return anything on success/failure, so neither can we
    40     update_blog_option( bp_get_option_blog_id( $option_name ), $option_name, $value );
     39    update_blog_option( bp_get_root_blog_id(), $option_name, $value );
    4140}
    4241
     
    5049 * @since 1.3
    5150 *
    52  * @uses bp_get_option_blog_id()
     51 * @uses bp_get_root_blog_id()
    5352 * @param str $option_name The option key to be set
    5453 */
    5554function bp_delete_option( $option_name ) {
    56     // update_blog_option() does not return anything on success/failure, so neither can we
    57     delete_blog_option( bp_get_option_blog_id( $option_name ), $option_name );
    58 }
    59 
    60 /**
    61  * Retrieve the filterable blog_id of the blog where the option is question is saved
    62  *
    63  * Since BP 1.3, BuddyPress has stored all of its settings in blog options tables, as opposed to
    64  * sitemeta. This makes it easier for non-standard setups (like BP_ENABLE_MULTIBLOG and
    65  * multinetwork BP) to save and access options in a consistent and logical way.
    66  *
    67  * By default, nearly all settings are stored in the options table of BP_ROOT_BLOG. The one
    68  * exception is when BP_ENABLE_MULTIBLOG is enabled. In this case, bp-pages - the list of pages that
    69  * are associated with BP top-level components - must be specific to each blog in the network. If
    70  * you are building a plugin that requires an option (either a BP-native option, or your own custom
    71  * option) to be specific to each blog in a network, filter 'bp_blog_specific_options' and add your
    72  * option's name. This will allow you to use bp_get_option() and bp_update_option() seamlessly.
    73  *
    74  * @package BuddyPress
    75  * @since 1.3
    76  *
    77  * @see bp_get_option()
    78  * @see bp_update_option()
    79  * @uses apply_filters() Filter bp_get_option_blog_id to change this setting
    80  * @return int $blog_id
    81  */
    82 function bp_get_option_blog_id( $option_name ) {
    83     $blog_specific_options = apply_filters( 'bp_blog_specific_options', array(
    84         'bp-pages'
    85     ) );
    86    
    87     if ( in_array( $option_name, $blog_specific_options ) ) {
    88         if ( defined( 'BP_ENABLE_MULTIBLOG' ) && BP_ENABLE_MULTIBLOG ) {
    89             $blog_id = get_current_blog_id();
    90         } else {
    91             $blog_id = BP_ROOT_BLOG;
    92         }
    93     } else {
    94         $blog_id = BP_ROOT_BLOG;
    95     }
    96 
    97     return apply_filters( 'bp_get_option_blog_id', $blog_id );
     55    delete_blog_option( bp_get_root_blog_id(), $option_name );
    9856}
    9957
     
    12684        $is_enable_multiblog = is_multisite() && defined( 'BP_ENABLE_MULTIBLOG' ) && BP_ENABLE_MULTIBLOG ? true : false;
    12785 
    128         $page_blog_id = $is_enable_multiblog ? get_current_blog_id() : BP_ROOT_BLOG;
     86        $page_blog_id = $is_enable_multiblog ? get_current_blog_id() : bp_get_root_blog_id();
    12987
    13088        if ( isset( $ms_page_ids[$page_blog_id] ) ) {
     
    142100 *
    143101 * bp-pages data is stored in site_options (falls back to options on non-MS), in an array keyed by
    144  * blog_id. This allows you to change your BP_ROOT_BLOG and go through the setup process again.
     102 * blog_id. This allows you to change your bp_get_root_blog_id() and go through the setup process again.
    145103 *
    146104 * @package BuddyPress Core
     
    170128    if ( $page_ids = bp_core_get_page_meta() ) {
    171129
    172         $posts_table_name = is_multisite() && !defined( 'BP_ENABLE_MULTIBLOG' ) ? $wpdb->get_blog_prefix( BP_ROOT_BLOG ) . 'posts' : $wpdb->posts;
     130        $posts_table_name = is_multisite() && !defined( 'BP_ENABLE_MULTIBLOG' ) ? $wpdb->get_blog_prefix( bp_get_root_blog_id() ) . 'posts' : $wpdb->posts;
    173131        $page_ids_sql     = implode( ',', (array)$page_ids );
    174132        $page_names       = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent, post_title FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) AND post_status = 'publish' " ) );
     
    513471    global $wpdb;
    514472
    515     if ( defined( 'BP_ENABLE_MULTIBLOG' ) )
    516         $domain = get_home_url( $wpdb->blogid );
    517     else
    518         $domain = get_home_url( BP_ROOT_BLOG );
     473    $domain = get_home_url( bp_get_root_blog_id() );
    519474
    520475    return apply_filters( 'bp_core_get_root_domain', $domain );
     
    10971052
    10981053/**
    1099  * Is this BP_ROOT_BLOG?
     1054 * Is this the root blog ID?
    11001055 *
    11011056 * @package BuddyPress
     
    11031058 *
    11041059 * @param int $blog_id Optional. Defaults to the current blog id.
    1105  * @return bool $is_root_blog Returns true if this is BP_ROOT_BLOG.
    1106  */
    1107 function bp_is_root_blog( $blog_id = false ) {
    1108     $is_root_blog = true;
    1109 
    1110     if ( !$blog_id )
     1060 * @return bool $is_root_blog Returns true if this is bp_get_root_blog_id().
     1061 */
     1062function bp_is_root_blog( $blog_id = 0 ) {
     1063   
     1064    // Assume false
     1065    $is_root_blog = false;
     1066
     1067    // Use current blog if no ID is passed
     1068    if ( empty( $blog_id ) )
    11111069        $blog_id = get_current_blog_id();
    11121070
    1113     if ( $blog_id != BP_ROOT_BLOG )
    1114         $is_root_blog = false;
    1115 
    1116     return apply_filters( 'bp_is_root_blog', $is_root_blog );
     1071    // Compare to root blog ID
     1072    if ( $blog_id == bp_get_root_blog_id() )
     1073        $is_root_blog = true;
     1074
     1075    return apply_filters( 'bp_is_root_blog', (bool) $is_root_blog );
     1076}
     1077
     1078/**
     1079 * Is this bp_get_root_blog_id()?
     1080 *
     1081 * @package BuddyPress
     1082 * @since 1.3
     1083 *
     1084 * @param int $blog_id Optional. Defaults to the current blog id.
     1085 * @return bool $is_root_blog Returns true if this is bp_get_root_blog_id().
     1086 */
     1087function bp_get_root_blog_id( $blog_id = false ) {
     1088
     1089    // Define on which blog ID BuddyPress should run
     1090    if ( !defined( 'BP_ROOT_BLOG' ) ) {
     1091
     1092        // Root blog is the main site on this network
     1093        if ( is_multisite() && !defined( 'BP_ENABLE_MULTIBLOG' ) ) {
     1094            $current_site = get_current_site();
     1095            $root_blog_id = $current_site->blog_id;
     1096
     1097        // Root blog is every site on this network
     1098        } elseif ( is_multisite() && defined( 'BP_ENABLE_MULTIBLOG' ) ) {
     1099            $root_blog_id = get_current_blog_id();
     1100
     1101        // Root blog is the only blog on this network
     1102        } elseif( !is_multisite() ) {
     1103            $root_blog_id = 1;
     1104        }
     1105
     1106        define( 'BP_ROOT_BLOG', $root_blog_id );
     1107       
     1108    // Root blog is defined
     1109    } else {
     1110        $root_blog_id = BP_ROOT_BLOG;
     1111    }
     1112
     1113    return apply_filters( 'bp_get_root_blog_id', (int) $root_blog_id );
    11171114}
    11181115
  • trunk/bp-core/bp-core-template.php

    r4596 r4602  
    169169    $root_blog_offset = false;
    170170    if ( $localize_time )
    171         $root_blog_offset = get_blog_option( BP_ROOT_BLOG, 'gmt_offset' );
     171        $root_blog_offset = get_blog_option( bp_get_root_blog_id(), 'gmt_offset' );
    172172
    173173    // Calculate offset time
  • trunk/bp-core/bp-core-wpabstraction.php

    r4559 r4602  
    3333    if ( !function_exists( 'switch_to_blog' ) ) {
    3434        function switch_to_blog() {
    35             return 1;
     35            return bp_get_root_blog_id();
    3636        }
    3737    }
     
    3939    if ( !function_exists( 'restore_current_blog' ) ) {
    4040        function restore_current_blog() {
    41             return 1;
     41            return bp_get_root_blog_id();
    4242        }
    4343    }
  • trunk/bp-forums/bp-forums-admin.php

    r4559 r4602  
    190190    $file .= "\n" .   '$bb->custom_user_meta_table = \'' . $wpdb->usermeta . '\';';
    191191    $file .= "\n\n" . '$bb->uri = \'' . BP_PLUGIN_URL . '/bp-forums/bbpress/\';';
    192     $file .= "\n" .   '$bb->name = \'' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . ' ' . __( 'Forums', 'buddypress' ) . '\';';
     192    $file .= "\n" .   '$bb->name = \'' . get_blog_option( bp_get_root_blog_id(), 'blogname' ) . ' ' . __( 'Forums', 'buddypress' ) . '\';';
    193193
    194194    if ( is_multisite() )
    195         $file .= "\n" .   '$bb->wordpress_mu_primary_blog_id = ' . BP_ROOT_BLOG . ';';
     195        $file .= "\n" .   '$bb->wordpress_mu_primary_blog_id = ' . bp_get_root_blog_id() . ';';
    196196
    197197    if ( defined( 'AUTH_SALT' ) )
  • trunk/bp-forums/bp-forums-bbpress-sa.php

    r4211 r4602  
    8484    // Set a site id if there isn't one already
    8585    if ( !isset( $bb->site_id ) )
    86         $bb->site_id = BP_ROOT_BLOG;
     86        $bb->site_id = bp_get_root_blog_id();
    8787
    8888    // Check if the tables are installed, if not, install them
  • trunk/bp-friends/bp-friends-notifications.php

    r4558 r4602  
    1919    // Set up and send the message
    2020    $to       = $ud->user_email;
    21     $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     21    $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES );
    2222    $subject  = '[' . $sitename . '] ' . sprintf( __( 'New friendship request from %s', 'buddypress' ), $initiator_name );
    2323
     
    6161    // Set up and send the message
    6262    $to       = $ud->user_email;
    63     $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     63    $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES );
    6464    $subject  = '[' . $sitename . '] ' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $friend_name );
    6565
  • trunk/bp-groups/bp-groups-notifications.php

    r4558 r4602  
    55
    66    $group    = new BP_Groups_Group( $group_id );
    7     $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     7    $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES );
    88    $subject  = '[' . $sitename . '] ' . __( 'Group Details Updated', 'buddypress' );
    99
     
    112112    // Set up and send the message
    113113    $to       = $ud->user_email;
    114     $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     114    $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES );
    115115
    116116    if ( $accepted ) {
     
    172172    // Set up and send the message
    173173    $to       = $ud->user_email;
    174     $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     174    $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES );
    175175    $subject  = '[' . $sitename . '] ' . sprintf( __( 'You have been promoted in the group: "%s"', 'buddypress' ), $group->name );
    176176
     
    222222        // Set up and send the message
    223223        $to       = $invited_ud->user_email;
    224         $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     224        $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES );
    225225        $subject  = '[' . $sitename . '] ' . sprintf( __( 'You have an invitation to the group: "%s"', 'buddypress' ), $group->name );
    226226
     
    284284            $ud = bp_core_get_core_userdata( $receiver_user_id );
    285285            $to = $ud->user_email;
    286             $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     286            $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES );
    287287            $subject  = '[' . $sitename . '] ' . sprintf( __( '%1$s mentioned you in the group "%2$s"', 'buddypress' ), $poster_name, $group->name );
    288288
  • trunk/bp-loader.php

    r4556 r4602  
    2828// Define on which blog ID BuddyPress should run
    2929if ( !defined( 'BP_ROOT_BLOG' ) ) {
    30     if ( is_multisite() ) {
     30   
     31    // Root blog is the main site on this network
     32    if ( is_multisite() && !defined( 'BP_ENABLE_MULTIBLOG' ) ) {
    3133        $current_site = get_current_site();
    3234        $root_blog_id = $current_site->blog_id;
    33     } else {
     35       
     36    // Root blog is every site on this network
     37    } elseif ( is_multisite() && defined( 'BP_ENABLE_MULTIBLOG' ) ) {
     38        $root_blog_id = get_current_blog_id();
     39       
     40    // Root blog is the only blog on this network
     41    } elseif( !is_multisite() ) {
    3442        $root_blog_id = 1;
    3543    }
     
    104112    // Switch the user to the new bp-default if they are using the old
    105113    // bp-default on activation.
    106     if ( 'bp-sn-parent' == get_blog_option( BP_ROOT_BLOG, 'template' ) && 'bp-default' == get_blog_option( BP_ROOT_BLOG, 'stylesheet' ) )
     114    if ( 'bp-sn-parent' == get_blog_option( bp_get_root_blog_id(), 'template' ) && 'bp-default' == get_blog_option( bp_get_root_blog_id(), 'stylesheet' ) )
    107115        switch_theme( 'bp-default', 'bp-default' );
    108116
  • trunk/bp-members/bp-members-actions.php

    r4400 r4602  
    4949        foreach ( (array) $blogs as $key => $details ) {
    5050            // Do not mark the main or current root blog as spam
    51             if ( 1 == $details->userblog_id || BP_ROOT_BLOG == $details->userblog_id )
     51            if ( 1 == $details->userblog_id || bp_get_root_blog_id() == $details->userblog_id )
    5252                continue;
    5353
  • trunk/bp-members/bp-members-buddybar.php

    r4565 r4602  
    4949
    5050    // Hide on root blog
    51     if ( $wpdb->blogid == BP_ROOT_BLOG || !bp_is_active( 'blogs' ) )
     51    if ( $wpdb->blogid == bp_get_root_blog_id() || !bp_is_active( 'blogs' ) )
    5252        return false;
    5353
  • trunk/bp-messages/bp-messages-notifications.php

    r4558 r4602  
    2525        // Set up and send the message
    2626        $email_to      = $ud->user_email;
    27         $sitename      = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     27        $sitename      = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES );
    2828        $email_subject = '[' . $sitename . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), $sender_name );
    2929
Note: See TracChangeset for help on using the changeset viewer.