Skip to:
Content

BuddyPress.org

Ticket #3445: 3445-3.patch

File 3445-3.patch, 11.4 KB (added by DJPaul, 13 years ago)
  • bp-core/bp-core-loader.php

     
    5757                /** Components ********************************************************/
    5858
    5959                // Set the included and optional components.
    60                 $bp->optional_components = array( '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' ) );
    6161
    62                 // Blogs component only available for multisite
    63                 if ( is_multisite() )
    64                         $bp->optional_components[] = 'blogs';
    65 
    66                 $bp->optional_components    = apply_filters( 'bp_optional_components', $bp->optional_components );
    67 
    6862                // Set the required components
    69                 $bp->required_components    = apply_filters( 'bp_required_components', array( 'members' ) );
     63                $bp->required_components = apply_filters( 'bp_required_components', array( 'members' ) );
    7064
    7165                // Get a list of activated components
    7266                if ( $active_components = bp_get_option( 'bp-active-components' ) ) {
  • bp-core/bp-core-functions.php

     
    352352         * wizard because of the order which the components are loaded. We check for multisite here
    353353         * on the off chance that someone has activated the blogs component and then disabled MS
    354354         */
    355         if ( is_multisite() && bp_is_active( 'blogs' ) ) {
     355        if ( bp_is_active( 'blogs' ) ) {
    356356                $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$bp->blogs->table_name}" ) );
    357357
    358358                if ( !$count )
  • bp-core/admin/bp-core-admin.php

     
    1313add_action( 'in_plugin_update_message-buddypress/bp-loader.php', 'bp_core_update_message' );
    1414
    1515/**
    16  * Renders the main admin panel.
    17  *
    18  * @package BuddyPress Core
    19  * @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 <?php
    44 }
    45 
    46 /**
    4716 * Renders the Settings admin panel.
    4817 *
    4918 * @package BuddyPress Core
     
    347316                        'title'       => __( 'Account Settings', 'buddypress' ),
    348317                        'description' => __( 'Allow your users to modify their account and notification settings directly from within their profiles.', 'buddypress' )
    349318                ),
    350                 'friends' => array(
     319                'friends'  => array(
    351320                        'title'       => __( 'Friend Connections', 'buddypress' ),
    352321                        'description' => __( 'Let your users make connections so they can track the activity of others and focus on the people they care about the most.', 'buddypress' )
    353322                ),
     
    359328                        'title'       => __( 'Activity Streams', 'buddypress' ),
    360329                        'description' => __( 'Global, personal, and group activity streams with threaded commenting, direct posting, favoriting and @mentions, all with full RSS feed and email notification support.', 'buddypress' )
    361330                ),
    362                 'groups' => array(
     331                'groups'   => array(
    363332                        'title'       => __( 'User Groups', 'buddypress' ),
    364333                        'description' => __( 'Groups allow your users to organize themselves into specific public, private or hidden sections with separate activity streams and member listings.', 'buddypress' )
    365334                ),
    366                 'forums' => array(
     335                'forums'   => array(
    367336                        'title'       => __( 'Discussion Forums', 'buddypress' ),
    368337                        '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' => __( 'Make BuddyPress aware of new posts and new comments from your site.', 'buddypress' )
    369342                )
    370343        ) );
    371344
    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'] = __( 'Make BuddyPress aware of new sites, new posts and new comments from across your entire network.', 'buddypress' );
    378347
    379348        // Required components
    380349        $required_components = apply_filters( 'bp_admin_required_components', array(
  • bp-core/admin/bp-core-update.php

     
    301301                        <tr valign="top">
    302302                                <th scope="row">
    303303                                        <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 a directory of the sites in your network.', 'buddypress' ); ?></p>
    305305                                </th>
    306306                                <td>
    307307                                        <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>
     
    311311
    312312                </table>
    313313
    314                 <p><?php _e( 'Would you like to enable site tracking, which tracks activity across all of your network?', 'buddypress' ); ?></p>
     314                <p><?php _e( 'Would you like to enable site tracking, which tracks blog posts and comments from across your network?', 'buddypress' ); ?></p>
    315315
    316316                <div class="left-col">
    317317
     
    427427
    428428                        <tr valign="top">
    429429                                <th scope="row">
    430                                         <h5><?php _e( 'Members', 'buddypres' ); ?></h5>
     430                                        <h5><?php _e( 'Members', 'buddypress' ); ?></h5>
    431431                                        <p><?php _e( 'Displays member profiles, and a directory of all site members.', 'buddypress' ); ?></p>
    432432                                </th>
    433433                                <td>
     
    471471                                <tr valign="top">
    472472                                        <th scope="row">
    473473                                                <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 a directory of public forum topics.', 'buddypress' ); ?></p>
    475475                                        </th>
    476476                                        <td>
    477477                                                <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>
     
    481481
    482482                        <?php endif; ?>
    483483
     484                        <?php /* The Blogs component only needs a directory page when Multisite is enabled */ ?>
    484485                        <?php if ( is_multisite() && isset( $active_components['blogs'] ) ) : ?>
    485486
    486487                                <tr valign="top">
    487488                                        <th scope="row">
    488489                                                <h5><?php _e( 'Sites', 'buddypress' ); ?></h5>
    489                                                 <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ); ?></p>
     490                                                <p><?php _e( 'Displays a directory of the sites in your network.', 'buddypress' ); ?></p>
    490491                                        </th>
    491492                                        <td>
    492493                                                <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>
     
    10221023                        // Load BP and hook the admin menu, so that the redirect is successful
    10231024                        if ( !function_exists( 'bp_core_update_message' ) )
    10241025                                require( WP_PLUGIN_DIR . '/buddypress/bp-core/admin/bp-core-admin.php' );
     1026
    10251027                        bp_core_add_admin_menu();
    10261028
    10271029                        // Redirect to the BuddyPress dashboard
     
    11091111        if ( !empty( $active_components['xprofile'] ) )
    11101112                bp_core_install_extended_profiles();
    11111113
    1112         // Only install blog tables if this is a multisite installation
    1113         if ( is_multisite() && !empty( $active_components['blogs'] ) )
     1114        // Blog tracking
     1115        if ( !empty( $active_components['blogs'] ) )
    11141116                bp_core_install_blog_tracking();
    11151117}
    11161118
     
    11361138        }
    11371139
    11381140        // On first installation - record all existing blogs in the system.
    1139         if ( !(int)$bp->site_options['bp-blogs-first-install'] && is_multisite() ) {
     1141        if ( !(int)$bp->site_options['bp-blogs-first-install'] ) {
    11401142                bp_blogs_record_existing_blogs();
    11411143                bp_update_option( 'bp-blogs-first-install', 1 );
    11421144        }
  • bp-blogs/bp-blogs-loader.php

     
    5353                        'path'                  => BP_PLUGIN_DIR,
    5454                        'slug'                  => BP_BLOGS_SLUG,
    5555                        'root_slug'             => isset( $bp->pages->blogs->slug ) ? $bp->pages->blogs->slug : BP_BLOGS_SLUG,
    56                         'has_directory'         => true,
     56                        'has_directory'         => is_multisite(), // Non-multisite installs don't need a top-level Sites directory, since there's only one site
    5757                        'notification_callback' => 'bp_blogs_format_notifications',
    5858                        'search_string'         => __( 'Search sites...', 'buddypress' ),
    5959                        'autocomplete_all'      => defined( 'BP_MESSAGES_AUTOCOMPLETE_ALL' ),
  • bp-blogs/bp-blogs-functions.php

     
    4949        // Truncate user blogs table and re-record.
    5050        $wpdb->query( "TRUNCATE TABLE {$bp->blogs->table_name}" );
    5151
    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 = 1;
    5356
    5457        if ( $blog_ids ) {
    5558                foreach( (array)$blog_ids as $blog_id ) {
    5659                        $users          = get_users( array( 'blog_id' => $blog_id ) );
    5760                        $subscribers    = get_users( array( 'blog_id' => $blog_id, 'role' => 'subscriber' ) );
    5861
    59                         if ( $users ) {
     62                        if ( !empty( $users ) ) {
    6063                                foreach ( (array)$users as $user ) {
    6164                                        // Don't record blogs for subscribers
    6265                                        if ( !in_array( $user, $subscribers ) )
     
    460463function bp_blogs_delete_blogmeta( $blog_id, $meta_key = false, $meta_value = false ) {
    461464        global $wpdb, $bp;
    462465
    463         if ( !is_numeric( $blog_id ) || !is_multisite() )
     466        if ( !is_numeric( $blog_id ) )
    464467                return false;
    465468
    466469        $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
     
    487490
    488491        $blog_id = (int) $blog_id;
    489492
    490         if ( !$blog_id || !is_multisite() )
     493        if ( !$blog_id )
    491494                return false;
    492495
    493496        if ( !empty($meta_key) ) {
     
    519522function bp_blogs_update_blogmeta( $blog_id, $meta_key, $meta_value ) {
    520523        global $wpdb, $bp;
    521524
    522         if ( !is_numeric( $blog_id ) || !is_multisite() )
     525        if ( !is_numeric( $blog_id ) )
    523526                return false;
    524527
    525528        $meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );