Skip to:
Content

BuddyPress.org

Changeset 2209 for trunk/bp-core.php


Ignore:
Timestamp:
12/27/2009 10:41:10 AM (14 years ago)
Author:
apeatling
Message:

Single WP support. Yes, you read that correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r2200 r2209  
    1111define( 'BP_PLUGIN_DIR', WP_PLUGIN_DIR . '/buddypress' );
    1212define( 'BP_PLUGIN_URL', plugins_url( $path = '/buddypress' ) );
     13
     14/* Load the WP abstraction file so BuddyPress can run on all WordPress setups. */
     15require ( BP_PLUGIN_DIR . '/bp-core/bp-core-wpabstraction.php' );
    1316
    1417/* Place your custom code (actions/filters) in a file called /plugins/bp-custom.php and it will be loaded before anything else. */
     
    6366    define( 'BP_HOME_BLOG_SLUG', 'blog' );
    6467
    65 /* Register BuddyPress themes contained within the theme folder */
    66 if ( function_exists( 'register_theme_folder' ) )
    67     register_theme_folder( 'buddypress/bp-themes' );
     68/* Register BuddyPress themes contained within the bp-theme folder */
     69if ( function_exists( 'register_theme_directory') )
     70    register_theme_directory( WP_PLUGIN_DIR . '/buddypress/bp-themes' );
    6871
    6972
     
    414417 */
    415418function bp_core_action_set_spammer_status() {
    416     global $bp;
     419    global $bp, $wpdb;
    417420
    418421    if ( !is_site_admin() || bp_is_home() || !$bp->displayed_user->id )
     
    424427
    425428        /* Get the functions file */
    426         require( ABSPATH . 'wp-admin/includes/mu.php' );
     429        if ( file_exists( ABSPATH . 'wp-admin/includes/mu.php' ) && bp_core_is_multiblog_install() )
     430            require( ABSPATH . 'wp-admin/includes/mu.php' );
    427431
    428432        if ( 'mark-spammer' == $bp->current_action )
     
    447451
    448452        /* Finally, mark this user as a spammer */
    449         update_user_status( $bp->displayed_user->id, 'spam', $is_spam, 1 );
     453        if ( bp_core_is_multiblog_install() )
     454            $wpdb->update( $wpdb->users, array( 'spam' => $is_spam ), array( 'ID' => $bp->displayed_user->id ) );
     455
     456        $wpdb->update( $wpdb->users, array( 'user_status' => $is_spam ), array( 'ID' => $bp->displayed_user->id ) );
    450457
    451458        if ( $is_spam )
     
    11691176 */
    11701177function bp_core_get_total_member_count() {
    1171     global $wpdb;
    1172 
    1173     $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM " . CUSTOM_USER_TABLE . " WHERE spam = 0" ) );
     1178    global $wpdb, $bp;
     1179
     1180    $status_sql = bp_core_get_status_sql();
     1181
     1182    $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM " . CUSTOM_USER_TABLE . " WHERE {$status_sql}" ) );
    11741183    return apply_filters( 'bp_core_get_total_member_count', $count );
    11751184}
     
    11871196    global $wpdb;
    11881197
    1189     return apply_filters( 'bp_core_is_user_spammer', (int) $wpdb->get_var( $wpdb->prepare( "SELECT spam FROM " . CUSTOM_USER_TABLE . " WHERE ID = %d", $user_id ) ) );
     1198    if ( bp_core_is_multiblog_install() )
     1199        $is_spammer = (int) $wpdb->get_var( $wpdb->prepare( "SELECT spam FROM " . CUSTOM_USER_TABLE . " WHERE ID = %d", $user_id ) );
     1200    else
     1201        $is_spammer = (int) $wpdb->get_var( $wpdb->prepare( "SELECT user_status FROM " . CUSTOM_USER_TABLE . " WHERE ID = %d", $user_id ) );
     1202
     1203    return apply_filters( 'bp_core_is_user_spammer', $is_spammer );
    11901204}
    11911205
Note: See TracChangeset for help on using the changeset viewer.