<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[BuddyPress] [2769] branches/1.2:
Fixing issue where a blog without a tagline would not show up in the front end blog list
.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>2769</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-22 16:58:16 +0000 (Mon, 22 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fixing issue where a blog without a tagline would not show up in the front end blog list.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches12bpblogsbpblogsclassesphp">branches/1.2/bp-blogs/bp-blogs-classes.php</a></li>
<li><a href="#branches12bpblogsphp">branches/1.2/bp-blogs.php</a></li>
<li><a href="#branches12bpcorebpcoreadminbarphp">branches/1.2/bp-core/bp-core-adminbar.php</a></li>
<li><a href="#branches12bpforumsbpforumsfiltersphp">branches/1.2/bp-forums/bp-forums-filters.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches12bpblogsbpblogsclassesphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-blogs/bp-blogs-classes.php (2768 => 2769)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-blogs/bp-blogs-classes.php        2010-02-22 16:03:25 UTC (rev 2768)
+++ branches/1.2/bp-blogs/bp-blogs-classes.php        2010-02-22 16:58:16 UTC (rev 2769)
</span><span class="lines">@@ -101,10 +101,10 @@
</span><span class="cx">
</span><span class="cx">                 if ( !empty( $search_terms ) ) {
</span><span class="cx">                         $filter = like_escape( $wpdb->escape( $search_terms ) );
</span><del>-                        $paged_blogs = $wpdb->get_results( "SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm2.meta_value as name, bm3.meta_value as description FROM {$bp->blogs->table_name} b, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2, {$bp->blogs->table_name_blogmeta} bm3, {$wpdb->base_prefix}blogs wb, {$wpdb->users} u WHERE b.blog_id = wb.blog_id AND b.user_id = u.ID AND b.blog_id = bm.blog_id AND b.blog_id = bm2.blog_id AND b.blog_id = bm3.blog_id AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'last_activity' AND bm2.meta_key = 'name' AND bm3.meta_key = 'description' AND ( bm2.meta_value LIKE '%%$filter%%' || bm3.meta_value LIKE '%%$filter%%' ) {$user_sql} GROUP BY b.blog_id {$order_sql} {$pag_sql}" );
</del><ins>+                        $paged_blogs = $wpdb->get_results( "SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm2.meta_value as name FROM {$bp->blogs->table_name} b, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2, {$wpdb->base_prefix}blogs wb, {$wpdb->users} u WHERE b.blog_id = wb.blog_id AND b.user_id = u.ID AND b.blog_id = bm.blog_id AND b.blog_id = bm2.blog_id AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'last_activity' AND bm2.meta_key = 'name' AND bm2.meta_value LIKE '%%$filter%%' {$user_sql} GROUP BY b.blog_id {$order_sql} {$pag_sql}" );
</ins><span class="cx">                         $total_blogs = $wpdb->get_var( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2 WHERE b.blog_id = wb.blog_id AND bm.blog_id = b.blog_id AND bm2.blog_id = b.blog_id AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'name' AND bm2.meta_key = 'description' AND ( bm.meta_value LIKE '%%$filter%%' || bm2.meta_value LIKE '%%$filter%%' ) {$user_sql}" );
</span><span class="cx">                 } else {
</span><del>-                        $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm2.meta_value as name, bm3.meta_value as description FROM {$bp->blogs->table_name} b, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2, {$bp->blogs->table_name_blogmeta} bm3, {$wpdb->base_prefix}blogs wb, {$wpdb->users} u WHERE b.blog_id = wb.blog_id AND b.user_id = u.ID AND b.blog_id = bm.blog_id AND b.blog_id = bm2.blog_id AND b.blog_id = bm3.blog_id {$user_sql} AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'last_activity' AND bm2.meta_key = 'name' AND bm3.meta_key = 'description' GROUP BY b.blog_id {$order_sql} {$pag_sql}" ) );
</del><ins>+                        $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm2.meta_value as name FROM {$bp->blogs->table_name} b, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2, {$wpdb->base_prefix}blogs wb, {$wpdb->users} u WHERE b.blog_id = wb.blog_id AND b.user_id = u.ID AND b.blog_id = bm.blog_id AND b.blog_id = bm2.blog_id {$user_sql} AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'last_activity' AND bm2.meta_key = 'name' GROUP BY b.blog_id {$order_sql} {$pag_sql}" ) );
</ins><span class="cx">                         $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb WHERE b.blog_id = wb.blog_id {$user_sql} AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql}" ) );
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="lines">@@ -161,9 +161,9 @@
</span><span class="cx">
</span><span class="cx">                 // Show logged in users their hidden blogs.
</span><span class="cx">                 if ( !bp_is_my_profile() && !$show_hidden )
</span><del>-                        $blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT b.id, bm1.meta_value as name, bm2.meta_value as description, wb.domain, wb.path FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb, {$bp->blogs->table_name_blogmeta} bm1, {$bp->blogs->table_name_blogmeta} bm2 WHERE b.blog_id = wb.blog_id AND b.blog_id = bm1.blog_id AND b.blog_id = bm2.blog_id AND bm1.meta_key = 'name' AND bm2.meta_key = 'description' AND wb.public = 1 AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND b.user_id = %d ORDER BY b.id", $user_id) );
</del><ins>+                        $blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT b.id, bm1.meta_value as name, wb.domain, wb.path FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb, {$bp->blogs->table_name_blogmeta} bm1 WHERE b.blog_id = wb.blog_id AND b.blog_id = bm1.blog_id AND bm1.meta_key = 'name' AND wb.public = 1 AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND b.user_id = %d ORDER BY b.id", $user_id ) );
</ins><span class="cx">                 else
</span><del>-                        $blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT b.id, bm1.meta_value as name, bm2.meta_value as description, wb.domain, wb.path FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb, {$bp->blogs->table_name_blogmeta} bm1, {$bp->blogs->table_name_blogmeta} bm2 WHERE b.blog_id = wb.blog_id AND b.blog_id = bm1.blog_id AND b.blog_id = bm2.blog_id AND bm1.meta_key = 'name' AND bm2.meta_key = 'description' AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND b.user_id = %d ORDER BY b.id", $user_id) );
</del><ins>+                        $blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT b.id, bm1.meta_value as name, wb.domain, wb.path FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb, {$bp->blogs->table_name_blogmeta} bm1 WHERE b.blog_id = wb.blog_id AND b.blog_id = bm1.blog_id AND bm1.meta_key = 'name' AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND b.user_id = %d ORDER BY b.id", $user_id ) );
</ins><span class="cx">
</span><span class="cx">                 $total_blog_count = BP_Blogs_Blog::total_blog_count_for_user( $user_id );
</span><span class="cx">
</span><span class="lines">@@ -172,7 +172,6 @@
</span><span class="cx">                         $user_blogs[$blog->id]->id = $blog->id;
</span><span class="cx">                         $user_blogs[$blog->id]->siteurl = ( is_ssl() ) ? 'https://' . $blog->domain . $blog->path : 'http://' . $blog->domain . $blog->path;
</span><span class="cx">                         $user_blogs[$blog->id]->name = $blog->name;
</span><del>-                        $user_blogs[$blog->id]->description = $blog->description;
</del><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 return array( 'blogs' => $user_blogs, 'count' => $total_blog_count );
</span><span class="lines">@@ -290,6 +289,16 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><ins>+                /* Fetch the blog description for each blog (as it may be empty we can't fetch it in the main query). */
+                $blog_descs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, meta_value as description FROM {$bp->blogs->table_name_blogmeta} WHERE meta_key = 'description' blog_id IN ( {$blog_ids} )" ) );
+
+                for ( $i = 0; $i < count( $paged_blogs ); $i++ ) {
+                        foreach ( (array)$blog_descs as $desc ) {
+                                if ( $desc->blog_id == $paged_blogs[$i]->blog_id )
+                                        $paged_blogs[$i]->description = $desc->description;
+                        }
+                }
+
</ins><span class="cx">                 return $paged_blogs;
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -306,6 +315,7 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* DEPRECATED - Post DB recording is scheduled for removal. Please use the activity stream to fetch a user's posts. */
</ins><span class="cx"> Class BP_Blogs_Post {
</span><span class="cx">         var $id;
</span><span class="cx">         var $user_id;
</span><span class="lines">@@ -513,6 +523,7 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* DEPRECATED - Comment DB recording is scheduled for removal. Please use the activity stream to fetch a user's comments. */
</ins><span class="cx"> Class BP_Blogs_Comment {
</span><span class="cx">         var $id;
</span><span class="cx">         var $user_id;
</span></span></pre></div>
<a id="branches12bpblogsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-blogs.php (2768 => 2769)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-blogs.php        2010-02-22 16:03:25 UTC (rev 2768)
+++ branches/1.2/bp-blogs.php        2010-02-22 16:58:16 UTC (rev 2769)
</span><span class="lines">@@ -676,10 +676,12 @@
</span><span class="cx">         return BP_Blogs_Blog::get_blogs_for_user( $user_id, $show_hidden );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* DEPRECATED - scheduled for removal. Please use the activity stream with a 'new_blog_post' filter. */
</ins><span class="cx"> function bp_blogs_get_posts_for_user( $user_id ) {
</span><span class="cx">         return BP_Blogs_Post::get_posts_for_user( $user_id );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* DEPRECATED - scheduled for removal. Please use the activity stream with a 'new_blog_comment' filter. */
</ins><span class="cx"> function bp_blogs_get_comments_for_user( $user_id ) {
</span><span class="cx">         return BP_Blogs_Comment::get_comments_for_user( $user_id );
</span><span class="cx"> }
</span></span></pre></div>
<a id="branches12bpcorebpcoreadminbarphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-adminbar.php (2768 => 2769)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-adminbar.php        2010-02-22 16:03:25 UTC (rev 2768)
+++ branches/1.2/bp-core/bp-core-adminbar.php        2010-02-22 16:58:16 UTC (rev 2769)
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">
</span><span class="cx">         $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
</span><span class="cx">
</span><del>-        echo '<li' . $alt . '><a id="bp-admin-logout" class="logout" href="' . wp_logout_url(site_url()) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
</del><ins>+        echo '<li' . $alt . '><a id="bp-admin-logout" class="logout" href="' . wp_logout_url( site_url() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
</ins><span class="cx">         echo '</ul>';
</span><span class="cx">         echo '</li>';
</span><span class="cx"> }
</span><span class="lines">@@ -119,15 +119,16 @@
</span><span class="cx">                 $counter = 0;
</span><span class="cx">                 foreach ( (array)$blogs['blogs'] as $blog ) {
</span><span class="cx">                         $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
</span><ins>+                        $site_url = esc_attr( $blog->siteurl );
</ins><span class="cx">
</span><span class="cx">                         echo '<li' . $alt . '>';
</span><del>-                        echo '<a href="' . esc_attr( $blog->siteurl ) . '">' . esc_html( $blog->name ) . '</a>';
</del><ins>+                        echo '<a href="' . $site_url . '">' . esc_html( $blog->name ) . '</a>';
</ins><span class="cx">
</span><span class="cx">                         echo '<ul>';
</span><del>-                        echo '<li class="alt"><a href="' . esc_attr( $blog->siteurl ) . 'wp-admin/">' . __( 'Dashboard', 'buddypress' ) . '</a></li>';
-                        echo '<li><a href="' . esc_attr( $blog->siteurl ) . 'wp-admin/post-new.php">' . __( 'New Post', 'buddypress' ) . '</a></li>';
-                        echo '<li class="alt"><a href="' . esc_attr( $blog->siteurl ) . 'wp-admin/edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>';
-                        echo '<li><a href="' . esc_attr( $blog->siteurl ) . 'wp-admin/edit-comments.php">' . __( 'Manage Comments', 'buddypress' ) . '</a></li>';
</del><ins>+                        echo '<li class="alt"><a href="' . $site_url . 'wp-admin/">' . __( 'Dashboard', 'buddypress' ) . '</a></li>';
+                        echo '<li><a href="' . $site_url . 'wp-admin/post-new.php">' . __( 'New Post', 'buddypress' ) . '</a></li>';
+                        echo '<li class="alt"><a href="' . $site_url . 'wp-admin/edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>';
+                        echo '<li><a href="' . $site_url . 'wp-admin/edit-comments.php">' . __( 'Manage Comments', 'buddypress' ) . '</a></li>';
</ins><span class="cx">                         echo '</ul>';
</span><span class="cx">
</span><span class="cx">                         echo '</li>';
</span></span></pre></div>
<a id="branches12bpforumsbpforumsfiltersphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-forums/bp-forums-filters.php (2768 => 2769)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-forums/bp-forums-filters.php        2010-02-22 16:03:25 UTC (rev 2768)
+++ branches/1.2/bp-forums/bp-forums-filters.php        2010-02-22 16:58:16 UTC (rev 2769)
</span><span class="lines">@@ -28,6 +28,8 @@
</span><span class="cx"> add_filter( 'bp_get_the_topic_post_content', 'stripslashes_deep' );
</span><span class="cx"> add_filter( 'bp_get_the_topic_title', 'stripslashes_deep' );
</span><span class="cx"> add_filter( 'bp_get_the_topic_latest_post_excerpt', 'stripslashes_deep' );
</span><ins>+add_filter( 'bp_get_the_topic_poster_name', 'stripslashes_deep' );
+add_filter( 'bp_get_the_topic_last_poster_name', 'stripslashes_deep' );
</ins><span class="cx">
</span><span class="cx"> add_filter( 'bp_get_the_topic_post_content', 'make_clickable' );
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>