Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/11/2012 06:01:03 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Add root_blog_id variable to $bp global, and remove extra logic from bp_get_root_blog_id().

File:
1 edited

Legend:

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

    r5683 r5716  
    528528 */
    529529function bp_core_get_last_activity( $last_activity_date, $string ) {
    530     if ( !$last_activity_date || empty( $last_activity_date ) )
    531         $last_active = __( 'not recently active', 'buddypress' );
     530
     531    if ( empty( $last_activity_date ) )
     532        $last_active = __( 'Not recently active', 'buddypress' );
    532533    else
    533534        $last_active = sprintf( $string, bp_core_time_since( $last_activity_date ) );
     
    807808        $is_root_blog = true;
    808809
    809     return apply_filters( 'bp_is_root_blog', (bool) $is_root_blog );
     810    return (bool) apply_filters( 'bp_is_root_blog', (bool) $is_root_blog );
    810811}
    811812
     
    814815 *
    815816 * @package BuddyPress
    816  * @since 1.5
    817  *
    818  * @return bool $is_root_blog Returns true if this is bp_get_root_blog_id().
     817 * @since BuddyPress (1.5)
     818 *
     819 * @return int Return the root site ID
    819820 */
    820821function bp_get_root_blog_id() {
    821 
    822     // Default to 1
    823     $root_blog_id = 1;
    824 
    825     // Define on which blog ID BuddyPress should run
    826     if ( !defined( 'BP_ROOT_BLOG' ) ) {
    827 
    828         // Root blog is the main site on this network
    829         if ( is_multisite() && !bp_is_multiblog_mode() ) {
    830             $current_site = get_current_site();
    831             $root_blog_id = $current_site->blog_id;
    832 
    833         // Root blog is whatever the current site is (could be any site on the network)
    834         } elseif ( is_multisite() && bp_is_multiblog_mode() ) {
    835             $root_blog_id = get_current_blog_id();
    836         }
    837 
    838         define( 'BP_ROOT_BLOG', $root_blog_id );
    839 
    840     // Root blog is defined
    841     } else {
    842         $root_blog_id = BP_ROOT_BLOG;
    843     }
    844 
    845     return apply_filters( 'bp_get_root_blog_id', (int) $root_blog_id );
     822    global $bp;
     823
     824    return (int) apply_filters( 'bp_get_root_blog_id', (int) $bp->root_blog_id );
    846825}
    847826
Note: See TracChangeset for help on using the changeset viewer.