<!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] [1924] trunk: Showing hidden groups to logged in site admins.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>1924</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-09-22 22:56:48 +0000 (Tue, 22 Sep 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Showing hidden groups to logged in site admins. Fixes #951</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpforumsbpforumstemplatetagsphp">trunk/bp-forums/bp-forums-templatetags.php</a></li>
<li><a href="#trunkbpgroupsbpgroupsclassesphp">trunk/bp-groups/bp-groups-classes.php</a></li>
<li><a href="#trunkbpthemesbpdefault_inccssscreencss">trunk/bp-themes/bp-default/_inc/css/screen.css</a></li>
<li><a href="#trunkbpthemesbpsnparentdirectoriesforumsforumsloopphp">trunk/bp-themes/bp-sn-parent/directories/forums/forums-loop.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpforumsbpforumstemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-templatetags.php (1923 => 1924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-templatetags.php        2009-09-22 22:39:12 UTC (rev 1923)
+++ trunk/bp-forums/bp-forums-templatetags.php        2009-09-22 22:56:48 UTC (rev 1924)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">                 $this->pag_num = isset( $_REQUEST['n'] ) ? intval( $_REQUEST['n'] ) : $per_page;
</span><span class="cx">                 
</span><span class="cx">                 /* Only show stickies if we are viewing a single group forum, otherwise we could end up with hundreds globally */
</span><del>-                if ( !$forum_id )
</del><ins>+                if ( $no_stickies )
</ins><span class="cx">                         $show_stickies = 'no'; // bbPress needs str 'no'
</span><span class="cx">
</span><span class="cx">                 switch ( $type ) {
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupsclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-classes.php (1923 => 1924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-classes.php        2009-09-22 22:39:12 UTC (rev 1923)
+++ trunk/bp-groups/bp-groups-classes.php        2009-09-22 22:56:48 UTC (rev 1924)
</span><span class="lines">@@ -279,8 +279,11 @@
</span><span class="cx">                         $order_sql = "ORDER BY $sort_by $order";
</span><span class="cx">                 }
</span><span class="cx">                 
</span><del>-                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE status != 'hidden' AND ( name LIKE '%%$filter%%' OR description LIKE '%%$filter%%' ) {$order_sql} {$pag_sql}" ) );
-                $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name} WHERE status != 'hidden' AND ( name LIKE '%%$filter%%' OR description LIKE '%%$filter%%' )" ) );
</del><ins>+                if ( !is_site_admin() )
+                        $hidden_sql = "AND status != 'hidden'";
+
+                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE ( name LIKE '%%$filter%%' OR description LIKE '%%$filter%%' ) {$hidden_sql} {$order_sql} {$pag_sql}" ) );
+                $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name} WHERE ( name LIKE '%%$filter%%' OR description LIKE '%%$filter%%' ) {$hidden_sq}" ) );
</ins><span class="cx">                 
</span><span class="cx">                 return array( 'groups' => $paged_groups, 'total' => $total_groups );
</span><span class="cx">         }
</span><span class="lines">@@ -330,12 +333,14 @@
</span><span class="cx">         function get_newest( $limit = null, $page = null ) {
</span><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">                                 
</span><del>-                if ( $limit && $page ) {
</del><ins>+                if ( $limit && $page )
</ins><span class="cx">                         $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
</span><del>-                }
</del><span class="cx">                 
</span><del>-                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE status != 'hidden' ORDER BY date_created DESC {$pag_sql}" ) );
-                $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name} WHERE status != 'hidden' ORDER BY date_created DESC", $limit ) );
</del><ins>+                if ( !is_site_admin() )
+                        $hidden_sql = "WHERE status != 'hidden'";
+                
+                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} {$hidden_sql} ORDER BY date_created DESC {$pag_sql}" ) );
+                $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name} {$hidden_sql} ORDER BY date_created DESC", $limit ) );
</ins><span class="cx">
</span><span class="cx">                 return array( 'groups' => $paged_groups, 'total' => $total_groups );
</span><span class="cx">         }
</span><span class="lines">@@ -343,12 +348,14 @@
</span><span class="cx">         function get_active( $limit = null, $page = null ) {
</span><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">                 
</span><del>-                if ( $limit && $page ) {
</del><ins>+                if ( $limit && $page )
</ins><span class="cx">                         $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
</span><del>-                }
</del><ins>+
+                if ( !is_site_admin() )
+                        $hidden_sql = "AND g.status != 'hidden'";
</ins><span class="cx">                 
</span><del>-                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}" ) );
-                $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(group_id) FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC" ) );
</del><ins>+                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id {$hidden_sql} AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}" ) );
+                $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(group_id) FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id {$hidden_sql} AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC" ) );
</ins><span class="cx">
</span><span class="cx">                 return array( 'groups' => $paged_groups, 'total' => $total_groups );
</span><span class="cx">         }
</span><span class="lines">@@ -359,9 +366,12 @@
</span><span class="cx">                 if ( $limit && $page ) {
</span><span class="cx">                         $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
</span><span class="cx">                 }
</span><ins>+
+                if ( !is_site_admin() )
+                        $hidden_sql = "AND g.status != 'hidden'";
</ins><span class="cx">                         
</span><del>-                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT gm.group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}" ) );
-                $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(gm.group_id) FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC" ) );
</del><ins>+                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT gm.group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id {$hidden_sql} AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}" ) );
+                $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(gm.group_id) FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id {$hidden_sql} AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC" ) );
</ins><span class="cx">
</span><span class="cx">                 return array( 'groups' => $paged_groups, 'total' => $total_groups );
</span><span class="cx">         }
</span><span class="lines">@@ -372,7 +382,7 @@
</span><span class="cx">                 if ( $limit && $page ) {
</span><span class="cx">                         $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
</span><span class="cx">                 }
</span><del>-                        
</del><ins>+
</ins><span class="cx">                 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT gm.group_id FROM {$bbdb->forums} AS f, {$bp->groups->table_name} AS g LEFT JOIN {$bp->groups->table_name_groupmeta} AS gm ON g.id = gm.group_id WHERE (gm.meta_key = 'forum_id' AND gm.meta_value = f.forum_id) AND g.status = 'public' ORDER BY f.topics DESC {$pag_sql}" ) );
</span><span class="cx">                 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT COUNT(gm.group_id) FROM {$bbdb->forums} AS f, {$bp->groups->table_name} AS g LEFT JOIN {$bp->groups->table_name_groupmeta} AS gm ON g.id = gm.group_id WHERE (gm.meta_key = 'forum_id' AND gm.meta_value = f.forum_id) AND g.status = 'public' ORDER BY f.topics DESC" ) );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_inccssscreencss"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/css/screen.css (1923 => 1924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/css/screen.css        2009-09-22 22:39:12 UTC (rev 1923)
+++ trunk/bp-themes/bp-default/_inc/css/screen.css        2009-09-22 22:56:48 UTC (rev 1924)
</span><span class="lines">@@ -830,6 +830,7 @@
</span><span class="cx">         border-bottom: 1px solid #FFE8C4;
</span><span class="cx">         display: inline-block;
</span><span class="cx">         font: normal 0.9em "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif !important;
</span><ins>+        max-width: 60%;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> div.avatar-block {
</span><span class="lines">@@ -1643,6 +1644,12 @@
</span><span class="cx">                 table#global-forum-topic-list td.td-poster, table#global-forum-topic-list td.td-group {
</span><span class="cx">                         min-width: 130px;
</span><span class="cx">                 }
</span><ins>+                
+                table#global-forum-topic-list img.avatar { float:left; }
+                
+                table#global-forum-topic-list div.poster-name, table#global-forum-topic-list div.object-name {
+                        margin-left: 35px;
+                }
</ins><span class="cx">
</span><span class="cx">         table#global-forum-topic-list th#th-title {
</span><span class="cx">                 width: 40%;
</span></span></pre></div>
<a id="trunkbpthemesbpsnparentdirectoriesforumsforumsloopphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-sn-parent/directories/forums/forums-loop.php (1923 => 1924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-sn-parent/directories/forums/forums-loop.php        2009-09-22 22:39:12 UTC (rev 1923)
+++ trunk/bp-themes/bp-sn-parent/directories/forums/forums-loop.php        2009-09-22 22:56:48 UTC (rev 1924)
</span><span class="lines">@@ -36,11 +36,11 @@
</span><span class="cx">                                 <a href="<?php bp_the_topic_permalink() ?>">
</span><span class="cx">                                         <?php bp_the_topic_last_poster_avatar( 'type=thumb&width=20&height=20' ) ?>
</span><span class="cx">                                 </a>
</span><del>-                                <?php bp_the_topic_last_poster_name() ?>
</del><ins>+                                <div class="poster-name"><?php bp_the_topic_last_poster_name() ?></div>
</ins><span class="cx">                         </td>
</span><span class="cx">                         <td class="td-group">
</span><span class="cx">                                 <a href="<?php bp_the_topic_object_permalink() ?>"><?php bp_the_topic_object_avatar( 'type=thumb&width=20&height=20' ) ?></a>
</span><del>-                                <a href="<?php bp_the_topic_object_permalink() ?>" title="<?php bp_the_topic_object_name() ?>"><?php bp_the_topic_object_name() ?></a>
</del><ins>+                                <div class="object-name"><a href="<?php bp_the_topic_object_permalink() ?>" title="<?php bp_the_topic_object_name() ?>"><?php bp_the_topic_object_name() ?></a></div>
</ins><span class="cx">                         </td>
</span><span class="cx">                         <td class="td-postcount">
</span><span class="cx">                                 <?php bp_the_topic_total_posts() ?>
</span></span></pre>
</div>
</div>
</body>
</html>