<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][4965] trunk: Fix blog posts not showing in activity stream in non-multisites.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/4965">4965</a></dd>
<dt>Author</dt> <dd>djpaul</dd>
<dt>Date</dt> <dd>2011-08-11 20:44:20 +0000 (Thu, 11 Aug 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix blog posts not showing in activity stream in non-multisites. Fixes <a href="http://buddypress.trac.wordpress.org/ticket/3445">#3445</a>, props boonebgorges and paulgibbs</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpblogsbpblogsfunctionsphp">trunk/bp-blogs/bp-blogs-functions.php</a></li>
<li><a href="#trunkbpblogsbpblogsloaderphp">trunk/bp-blogs/bp-blogs-loader.php</a></li>
<li><a href="#trunkbpcoreadminbpcoreadminphp">trunk/bp-core/admin/bp-core-admin.php</a></li>
<li><a href="#trunkbpcoreadminbpcoreupdatephp">trunk/bp-core/admin/bp-core-update.php</a></li>
<li><a href="#trunkbpcorebpcorefunctionsphp">trunk/bp-core/bp-core-functions.php</a></li>
<li><a href="#trunkbpcorebpcoreloaderphp">trunk/bp-core/bp-core-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpblogsbpblogsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-functions.php (4964 => 4965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-functions.php        2011-08-10 13:30:58 UTC (rev 4964)
+++ trunk/bp-blogs/bp-blogs-functions.php        2011-08-11 20:44:20 UTC (rev 4965)
</span><span class="lines">@@ -49,14 +49,17 @@
</span><span class="cx">         // Truncate user blogs table and re-record.
</span><span class="cx">         $wpdb->query( "TRUNCATE TABLE {$bp->blogs->table_name}" );
</span><span class="cx">
</span><del>-        $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0" ) );
</del><ins>+        if ( is_multisite() )
+                $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0" ) );
+        else
+                $blog_ids = 1;
</ins><span class="cx">
</span><span class="cx">         if ( $blog_ids ) {
</span><span class="cx">                 foreach( (array)$blog_ids as $blog_id ) {
</span><span class="cx">                         $users                 = get_users( array( 'blog_id' => $blog_id ) );
</span><span class="cx">                         $subscribers         = get_users( array( 'blog_id' => $blog_id, 'role' => 'subscriber' ) );
</span><span class="cx">
</span><del>-                        if ( $users ) {
</del><ins>+                        if ( !empty( $users ) ) {
</ins><span class="cx">                                 foreach ( (array)$users as $user ) {
</span><span class="cx">                                         // Don't record blogs for subscribers
</span><span class="cx">                                         if ( !in_array( $user, $subscribers ) )
</span><span class="lines">@@ -460,7 +463,7 @@
</span><span class="cx"> function bp_blogs_delete_blogmeta( $blog_id, $meta_key = false, $meta_value = false ) {
</span><span class="cx">         global $wpdb, $bp;
</span><span class="cx">
</span><del>-        if ( !is_numeric( $blog_id ) || !is_multisite() )
</del><ins>+        if ( !is_numeric( $blog_id ) )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><span class="cx">         $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
</span><span class="lines">@@ -487,7 +490,7 @@
</span><span class="cx">
</span><span class="cx">         $blog_id = (int) $blog_id;
</span><span class="cx">
</span><del>-        if ( !$blog_id || !is_multisite() )
</del><ins>+        if ( !$blog_id )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><span class="cx">         if ( !empty($meta_key) ) {
</span><span class="lines">@@ -519,7 +522,7 @@
</span><span class="cx"> function bp_blogs_update_blogmeta( $blog_id, $meta_key, $meta_value ) {
</span><span class="cx">         global $wpdb, $bp;
</span><span class="cx">
</span><del>-        if ( !is_numeric( $blog_id ) || !is_multisite() )
</del><ins>+        if ( !is_numeric( $blog_id ) )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><span class="cx">         $meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );
</span></span></pre></div>
<a id="trunkbpblogsbpblogsloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-loader.php (4964 => 4965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-loader.php        2011-08-10 13:30:58 UTC (rev 4964)
+++ trunk/bp-blogs/bp-blogs-loader.php        2011-08-11 20:44:20 UTC (rev 4965)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">                         'path' => BP_PLUGIN_DIR,
</span><span class="cx">                         'slug' => BP_BLOGS_SLUG,
</span><span class="cx">                         'root_slug' => isset( $bp->pages->blogs->slug ) ? $bp->pages->blogs->slug : BP_BLOGS_SLUG,
</span><del>-                        'has_directory' => true,
</del><ins>+                        'has_directory' => is_multisite(), // Non-multisite installs don't need a top-level Sites directory, since there's only one site
</ins><span class="cx">                         'notification_callback' => 'bp_blogs_format_notifications',
</span><span class="cx">                         'search_string' => __( 'Search sites...', 'buddypress' ),
</span><span class="cx">                         'autocomplete_all' => defined( 'BP_MESSAGES_AUTOCOMPLETE_ALL' ),
</span></span></pre></div>
<a id="trunkbpcoreadminbpcoreadminphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/admin/bp-core-admin.php (4964 => 4965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/admin/bp-core-admin.php        2011-08-10 13:30:58 UTC (rev 4964)
+++ trunk/bp-core/admin/bp-core-admin.php        2011-08-11 20:44:20 UTC (rev 4965)
</span><span class="lines">@@ -13,37 +13,6 @@
</span><span class="cx"> add_action( 'in_plugin_update_message-buddypress/bp-loader.php', 'bp_core_update_message' );
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Renders the main admin panel.
- *
- * @package BuddyPress Core
- * @since {@internal Unknown}}
- */
-function bp_core_admin_dashboard() {
-        $base_url = bp_get_admin_url( 'admin.php' );
-        $action = add_query_arg( array( 'page' => 'bp-general-settings' ), $base_url );
-        ?>
-
-        <div class="wrap" id="bp-admin">
-
-                <div id="bp-admin-header">
-                        <h3><?php _e( 'BuddyPress', 'buddypress' ); ?></h3>
-                        <h2><?php _e( 'Dashboard', 'buddypress' ); ?></h2>
-                </div>
-
-                <?php do_action( 'bp_admin_notices' ); ?>
-
-                <form action="<?php echo $action ?>" method="post" id="bp-admin-form">
-                        <div id="bp-admin-content">
-                                <p>[TODO: All sorts of awesome things will go here. Latest plugins and themes, stats, version check, support topics, news, tips]</p>
-                        </div>
-                </form>
-
-        </div>
-
-<?php
-}
-
-/**
</del><span class="cx"> * Renders the Settings admin panel.
</span><span class="cx"> *
</span><span class="cx"> * @package BuddyPress Core
</span><span class="lines">@@ -347,7 +316,7 @@
</span><span class="cx">                         'title' => __( 'Account Settings', 'buddypress' ),
</span><span class="cx">                         'description' => __( 'Allow your users to modify their account and notification settings directly from within their profiles.', 'buddypress' )
</span><span class="cx">                 ),
</span><del>-                'friends' => array(
</del><ins>+                'friends' => array(
</ins><span class="cx">                         'title' => __( 'Friend Connections', 'buddypress' ),
</span><span class="cx">                         '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' )
</span><span class="cx">                 ),
</span><span class="lines">@@ -359,22 +328,22 @@
</span><span class="cx">                         'title' => __( 'Activity Streams', 'buddypress' ),
</span><span class="cx">                         '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' )
</span><span class="cx">                 ),
</span><del>-                'groups' => array(
</del><ins>+                'groups' => array(
</ins><span class="cx">                         'title' => __( 'User Groups', 'buddypress' ),
</span><span class="cx">                         'description' => __( 'Groups allow your users to organize themselves into specific public, private or hidden sections with separate activity streams and member listings.', 'buddypress' )
</span><span class="cx">                 ),
</span><del>-                'forums' => array(
</del><ins>+                'forums' => array(
</ins><span class="cx">                         'title' => __( 'Discussion Forums', 'buddypress' ),
</span><span class="cx">                         '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' )
</span><ins>+                ),
+                'blogs' => array(
+                        'title' => __( 'Site Tracking', 'buddypress' ),
+                        'description' => __( 'Make BuddyPress aware of new posts and new comments from your site.', 'buddypress' )
</ins><span class="cx">                 )
</span><span class="cx">         ) );
</span><span class="cx">
</span><del>-        if ( is_multisite() ) {
-                $optional_components['blogs'] = array(
-                        'title' => __( 'Site Tracking', 'buddypress' ),
-                        'description' => __( 'Track new sites, new posts and new comments across your entire network.', 'buddypress' )
-                );
-        }
</del><ins>+        if ( is_multisite() )
+                $optional_components['blogs']['description'] = __( 'Make BuddyPress aware of new sites, new posts and new comments from across your entire network.', 'buddypress' );
</ins><span class="cx">
</span><span class="cx">         // Required components
</span><span class="cx">         $required_components = apply_filters( 'bp_admin_required_components', array(
</span></span></pre></div>
<a id="trunkbpcoreadminbpcoreupdatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/admin/bp-core-update.php (4964 => 4965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/admin/bp-core-update.php        2011-08-10 13:30:58 UTC (rev 4964)
+++ trunk/bp-core/admin/bp-core-update.php        2011-08-11 20:44:20 UTC (rev 4965)
</span><span class="lines">@@ -301,7 +301,7 @@
</span><span class="cx">                         <tr valign="top">
</span><span class="cx">                                 <th scope="row">
</span><span class="cx">                                         <h5><?php _e( 'Sites', 'buddypress' ); ?></h5>
</span><del>-                                        <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ); ?></p>
</del><ins>+                                        <p><?php _e( 'Displays a directory of the sites in your network.', 'buddypress' ); ?></p>
</ins><span class="cx">                                 </th>
</span><span class="cx">                                 <td>
</span><span class="cx">                                         <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>
</span><span class="lines">@@ -311,7 +311,7 @@
</span><span class="cx">
</span><span class="cx">                 </table>
</span><span class="cx">
</span><del>-                <p><?php _e( 'Would you like to enable site tracking, which tracks activity across all of your network?', 'buddypress' ); ?></p>
</del><ins>+                <p><?php _e( 'Would you like to enable site tracking, which tracks blog posts and comments from across your network?', 'buddypress' ); ?></p>
</ins><span class="cx">
</span><span class="cx">                 <div class="left-col">
</span><span class="cx">
</span><span class="lines">@@ -427,7 +427,7 @@
</span><span class="cx">
</span><span class="cx">                         <tr valign="top">
</span><span class="cx">                                 <th scope="row">
</span><del>-                                        <h5><?php _e( 'Members', 'buddypres' ); ?></h5>
</del><ins>+                                        <h5><?php _e( 'Members', 'buddypress' ); ?></h5>
</ins><span class="cx">                                         <p><?php _e( 'Displays member profiles, and a directory of all site members.', 'buddypress' ); ?></p>
</span><span class="cx">                                 </th>
</span><span class="cx">                                 <td>
</span><span class="lines">@@ -471,7 +471,7 @@
</span><span class="cx">                                 <tr valign="top">
</span><span class="cx">                                         <th scope="row">
</span><span class="cx">                                                 <h5><?php _e( 'Forums', 'buddypress' ); ?></h5>
</span><del>-                                                <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ); ?></p>
</del><ins>+                                                <p><?php _e( 'Displays a directory of public forum topics.', 'buddypress' ); ?></p>
</ins><span class="cx">                                         </th>
</span><span class="cx">                                         <td>
</span><span class="cx">                                                 <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>
</span><span class="lines">@@ -481,12 +481,13 @@
</span><span class="cx">
</span><span class="cx">                         <?php endif; ?>
</span><span class="cx">
</span><ins>+                        <?php /* The Blogs component only needs a directory page when Multisite is enabled */ ?>
</ins><span class="cx">                         <?php if ( is_multisite() && isset( $active_components['blogs'] ) ) : ?>
</span><span class="cx">
</span><span class="cx">                                 <tr valign="top">
</span><span class="cx">                                         <th scope="row">
</span><span class="cx">                                                 <h5><?php _e( 'Sites', 'buddypress' ); ?></h5>
</span><del>-                                                <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ); ?></p>
</del><ins>+                                                <p><?php _e( 'Displays a directory of the sites in your network.', 'buddypress' ); ?></p>
</ins><span class="cx">                                         </th>
</span><span class="cx">                                         <td>
</span><span class="cx">                                                 <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>
</span><span class="lines">@@ -1022,6 +1023,7 @@
</span><span class="cx">                         // Load BP and hook the admin menu, so that the redirect is successful
</span><span class="cx">                         if ( !function_exists( 'bp_core_update_message' ) )
</span><span class="cx">                                 require( WP_PLUGIN_DIR . '/buddypress/bp-core/admin/bp-core-admin.php' );
</span><ins>+
</ins><span class="cx">                         bp_core_add_admin_menu();
</span><span class="cx">
</span><span class="cx">                         // Redirect to the BuddyPress dashboard
</span><span class="lines">@@ -1109,8 +1111,8 @@
</span><span class="cx">         if ( !empty( $active_components['xprofile'] ) )
</span><span class="cx">                 bp_core_install_extended_profiles();
</span><span class="cx">
</span><del>-        // Only install blog tables if this is a multisite installation
-        if ( is_multisite() && !empty( $active_components['blogs'] ) )
</del><ins>+        // Blog tracking
+        if ( !empty( $active_components['blogs'] ) )
</ins><span class="cx">                 bp_core_install_blog_tracking();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1136,7 +1138,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         // On first installation - record all existing blogs in the system.
</span><del>-        if ( !(int)$bp->site_options['bp-blogs-first-install'] && is_multisite() ) {
</del><ins>+        if ( !(int)$bp->site_options['bp-blogs-first-install'] ) {
</ins><span class="cx">                 bp_blogs_record_existing_blogs();
</span><span class="cx">                 bp_update_option( 'bp-blogs-first-install', 1 );
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkbpcorebpcorefunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-functions.php (4964 => 4965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-functions.php        2011-08-10 13:30:58 UTC (rev 4964)
+++ trunk/bp-core/bp-core-functions.php        2011-08-11 20:44:20 UTC (rev 4965)
</span><span class="lines">@@ -352,7 +352,7 @@
</span><span class="cx">          * wizard because of the order which the components are loaded. We check for multisite here
</span><span class="cx">          * on the off chance that someone has activated the blogs component and then disabled MS
</span><span class="cx">          */
</span><del>-        if ( is_multisite() && bp_is_active( 'blogs' ) ) {
</del><ins>+        if ( bp_is_active( 'blogs' ) ) {
</ins><span class="cx">                 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$bp->blogs->table_name}" ) );
</span><span class="cx">
</span><span class="cx">                 if ( !$count )
</span></span></pre></div>
<a id="trunkbpcorebpcoreloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-loader.php (4964 => 4965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-loader.php        2011-08-10 13:30:58 UTC (rev 4964)
+++ trunk/bp-core/bp-core-loader.php        2011-08-11 20:44:20 UTC (rev 4965)
</span><span class="lines">@@ -57,16 +57,10 @@
</span><span class="cx">                 /** Components ********************************************************/
</span><span class="cx">
</span><span class="cx">                 // Set the included and optional components.
</span><del>-                $bp->optional_components = array( 'activity', 'forums', 'friends', 'groups', 'messages', 'settings', 'xprofile' );
</del><ins>+                $bp->optional_components = apply_filters( 'bp_optional_components', array( 'activity', 'blogs', 'forums', 'friends', 'groups', 'messages', 'settings', 'xprofile' ) );
</ins><span class="cx">
</span><del>-                // Blogs component only available for multisite
-                if ( is_multisite() )
-                        $bp->optional_components[] = 'blogs';
-
-                $bp->optional_components = apply_filters( 'bp_optional_components', $bp->optional_components );
-
</del><span class="cx">                 // Set the required components
</span><del>-                $bp->required_components = apply_filters( 'bp_required_components', array( 'members' ) );
</del><ins>+                $bp->required_components = apply_filters( 'bp_required_components', array( 'members' ) );
</ins><span class="cx">
</span><span class="cx">                 // Get a list of activated components
</span><span class="cx">                 if ( $active_components = bp_get_option( 'bp-active-components' ) ) {
</span></span></pre>
</div>
</div>
</body>
</html>