Ticket #3445: 3445-1.patch
File 3445-1.patch, 9.8 KB (added by , 13 years ago) |
---|
-
bp-core/bp-core-loader.php
57 57 /** Components ********************************************************/ 58 58 59 59 // Set the included and optional components. 60 $bp->optional_components = a rray( 'activity', 'forums', 'friends', 'groups', 'messages', 'settings', 'xprofile');60 $bp->optional_components = apply_filters( 'bp_optional_components', array( 'activity', 'blogs', 'forums', 'friends', 'groups', 'messages', 'settings', 'xprofile' ) ); 61 61 62 // Blogs component only available for multisite63 if ( is_multisite() )64 $bp->optional_components[] = 'blogs';65 66 $bp->optional_components = apply_filters( 'bp_optional_components', $bp->optional_components );67 68 62 // Set the required components 69 $bp->required_components 63 $bp->required_components = apply_filters( 'bp_required_components', array( 'members' ) ); 70 64 71 65 // Get a list of activated components 72 66 if ( $active_components = bp_get_option( 'bp-active-components' ) ) { -
bp-core/bp-core-functions.php
352 352 * wizard because of the order which the components are loaded. We check for multisite here 353 353 * on the off chance that someone has activated the blogs component and then disabled MS 354 354 */ 355 if ( is_multisite() &&bp_is_active( 'blogs' ) ) {355 if ( bp_is_active( 'blogs' ) ) { 356 356 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$bp->blogs->table_name}" ) ); 357 357 358 358 if ( !$count ) … … 1464 1464 if ( 'remove_canonical_direct' == $redirect ) 1465 1465 remove_action( 'template_redirect', 'redirect_canonical' ); 1466 1466 } 1467 ?> 1467 ?> 1468 No newline at end of file -
bp-core/admin/bp-core-admin.php
13 13 add_action( 'in_plugin_update_message-buddypress/bp-loader.php', 'bp_core_update_message' ); 14 14 15 15 /** 16 * Renders the main admin panel.17 *18 * @package BuddyPress Core19 * @since {@internal Unknown}}20 */21 function bp_core_admin_dashboard() {22 $base_url = bp_get_admin_url( 'admin.php' );23 $action = add_query_arg( array( 'page' => 'bp-general-settings' ), $base_url );24 ?>25 26 <div class="wrap" id="bp-admin">27 28 <div id="bp-admin-header">29 <h3><?php _e( 'BuddyPress', 'buddypress' ); ?></h3>30 <h2><?php _e( 'Dashboard', 'buddypress' ); ?></h2>31 </div>32 33 <?php do_action( 'bp_admin_notices' ); ?>34 35 <form action="<?php echo $action ?>" method="post" id="bp-admin-form">36 <div id="bp-admin-content">37 <p>[TODO: All sorts of awesome things will go here. Latest plugins and themes, stats, version check, support topics, news, tips]</p>38 </div>39 </form>40 41 </div>42 43 <?php44 }45 46 /**47 16 * Renders the Settings admin panel. 48 17 * 49 18 * @package BuddyPress Core … … 366 335 'forums' => array( 367 336 'title' => __( 'Discussion Forums', 'buddypress' ), 368 337 'description' => __( 'Full powered discussion forums built directly into groups allow for more conventional in-depth conversations. NOTE: This will require an extra (but easy) setup step.', 'buddypress' ) 338 ), 339 'blogs' => array( 340 'title' => __( 'Site Tracking', 'buddypress' ), 341 'description' => __( 'Track new posts and new comments across your entire site.', 'buddypress' ) 369 342 ) 370 343 ) ); 371 344 372 if ( is_multisite() ) { 373 $optional_components['blogs'] = array( 374 'title' => __( 'Site Tracking', 'buddypress' ), 375 'description' => __( 'Track new sites, new posts and new comments across your entire network.', 'buddypress' ) 376 ); 377 } 345 if ( is_multisite() ) 346 $optional_components['blogs']['description'] = __( 'Track new sites, new posts and new comments across your entire network.', 'buddypress' ); 378 347 379 348 // Required components 380 349 $required_components = apply_filters( 'bp_admin_required_components', array( … … 620 589 wp_enqueue_style( 'thickbox' ); 621 590 } 622 591 623 ?> 592 ?> 593 No newline at end of file -
bp-core/admin/bp-core-update.php
301 301 <tr valign="top"> 302 302 <th scope="row"> 303 303 <h5><?php _e( 'Sites', 'buddypress' ); ?></h5> 304 <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ); ?></p>304 <p><?php _e( 'Displays individual sites as well as a directory of sites (multisite only).', 'buddypress' ); ?></p> 305 305 </th> 306 306 <td> 307 307 <p><input type="radio" name="bp_pages[blogs]" checked="checked" value="<?php echo $blogs_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo site_url( $blogs_slug ); ?>/</p> … … 471 471 <tr valign="top"> 472 472 <th scope="row"> 473 473 <h5><?php _e( 'Forums', 'buddypress' ); ?></h5> 474 <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ); ?></p>474 <p><?php _e( 'Displays individual forums as well as a directory of forums.', 'buddypress' ); ?></p> 475 475 </th> 476 476 <td> 477 477 <p><label><input type="radio" name="bp_pages[forums]" <?php checked( empty( $existing_pages['forums'] ) ); ?> value="<?php echo $forums_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $forums_slug ); ?>/</label></p> … … 481 481 482 482 <?php endif; ?> 483 483 484 <?php if ( is _multisite() && isset( $active_components['blogs'] ) ) : ?>484 <?php if ( isset( $active_components['blogs'] ) ) : ?> 485 485 486 486 <tr valign="top"> 487 487 <th scope="row"> 488 488 <h5><?php _e( 'Sites', 'buddypress' ); ?></h5> 489 <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ); ?></p>489 <p><?php _e( 'Displays individual sites as well as a directory of sites (multisite only).', 'buddypress' ); ?></p> 490 490 </th> 491 491 <td> 492 492 <p><label><input type="radio" name="bp_pages[blogs]" <?php checked( empty( $existing_pages['blogs'] ) ); ?> value="<?php echo $blogs_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $blogs_slug ); ?>/</label></p> … … 1022 1022 // Load BP and hook the admin menu, so that the redirect is successful 1023 1023 if ( !function_exists( 'bp_core_update_message' ) ) 1024 1024 require( WP_PLUGIN_DIR . '/buddypress/bp-core/admin/bp-core-admin.php' ); 1025 1025 1026 bp_core_add_admin_menu(); 1026 1027 1027 1028 // Redirect to the BuddyPress dashboard … … 1109 1110 if ( !empty( $active_components['xprofile'] ) ) 1110 1111 bp_core_install_extended_profiles(); 1111 1112 1112 // Only install blog tables if this is a multisite installation1113 if ( is_multisite() &&!empty( $active_components['blogs'] ) )1113 // Blog tracking 1114 if ( !empty( $active_components['blogs'] ) ) 1114 1115 bp_core_install_blog_tracking(); 1115 1116 } 1116 1117 … … 1136 1137 } 1137 1138 1138 1139 // On first installation - record all existing blogs in the system. 1139 if ( !(int)$bp->site_options['bp-blogs-first-install'] && is_multisite()) {1140 if ( !(int)$bp->site_options['bp-blogs-first-install'] ) { 1140 1141 bp_blogs_record_existing_blogs(); 1141 1142 bp_update_option( 'bp-blogs-first-install', 1 ); 1142 1143 } … … 1321 1322 add_action( 'admin_notices', 'bp_core_update_nag', 5 ); 1322 1323 add_action( 'network_admin_notices', 'bp_core_update_nag', 5 ); 1323 1324 1324 ?> 1325 ?> 1326 No newline at end of file -
bp-blogs/bp-blogs-functions.php
49 49 // Truncate user blogs table and re-record. 50 50 $wpdb->query( "TRUNCATE TABLE {$bp->blogs->table_name}" ); 51 51 52 $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0" ) ); 52 if ( is_multisite() ) 53 $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0" ) ); 54 else 55 $blog_ids = array( 1 ); 53 56 54 if ( $blog_ids ) { 55 foreach( (array)$blog_ids as $blog_id ) { 56 $users = get_users( array( 'blog_id' => $blog_id ) ); 57 $subscribers = get_users( array( 'blog_id' => $blog_id, 'role' => 'subscriber' ) ); 58 59 if ( $users ) { 60 foreach ( (array)$users as $user ) { 61 // Don't record blogs for subscribers 62 if ( !in_array( $user, $subscribers ) ) 63 bp_blogs_record_blog( $blog_id, $user->ID, true ); 64 } 57 foreach( (array) $blog_ids as $blog_id ) { 58 $users = get_users( array( 'blog_id' => $blog_id ) ); 59 $subscribers = get_users( array( 'blog_id' => $blog_id, 'role' => 'subscriber' ) ); 60 61 if ( !empty( $users ) ) { 62 foreach ( (array)$users as $user ) { 63 // Don't record blogs for subscribers 64 if ( !in_array( $user, $subscribers ) ) 65 bp_blogs_record_blog( $blog_id, $user->ID, true ); 65 66 } 66 67 } 67 68 } … … 454 455 function bp_blogs_delete_blogmeta( $blog_id, $meta_key = false, $meta_value = false ) { 455 456 global $wpdb, $bp; 456 457 457 if ( !is_numeric( $blog_id ) || !is_multisite())458 if ( !is_numeric( $blog_id ) ) 458 459 return false; 459 460 460 461 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); … … 481 482 482 483 $blog_id = (int) $blog_id; 483 484 484 if ( !$blog_id || !is_multisite())485 if ( !$blog_id ) 485 486 return false; 486 487 487 488 if ( !empty($meta_key) ) { … … 513 514 function bp_blogs_update_blogmeta( $blog_id, $meta_key, $meta_value ) { 514 515 global $wpdb, $bp; 515 516 516 if ( !is_numeric( $blog_id ) || !is_multisite())517 if ( !is_numeric( $blog_id ) ) 517 518 return false; 518 519 519 520 $meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );