<!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] [2622] trunk: Fixes #1840</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2622</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-08 12:33:13 +0000 (Mon, 08 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixes #1840</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpgroupsbpgroupsclassesphp">trunk/bp-groups/bp-groups-classes.php</a></li>
<li><a href="#trunkbpgroupsbpgroupstemplatetagsphp">trunk/bp-groups/bp-groups-templatetags.php</a></li>
<li><a href="#trunkbpgroupsphp">trunk/bp-groups.php</a></li>
<li><a href="#trunkbpthemesbpdefaultactivitypostformphp">trunk/bp-themes/bp-default/activity/post-form.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpgroupsbpgroupsclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-classes.php (2621 => 2622)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-classes.php        2010-02-08 12:12:04 UTC (rev 2621)
+++ trunk/bp-groups/bp-groups-classes.php        2010-02-08 12:33:13 UTC (rev 2622)
</span><span class="lines">@@ -257,7 +257,7 @@
</span><span class="cx"> 
</span><span class="cx">         /* TODO: Merge all these get_() functions into one. */
</span><span class="cx"> 
</span><del>-        function get_newest( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
</del><ins>+        function get_newest( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx"> 
</span><span class="cx">                 if ( $limit &amp;&amp; $page )
</span><span class="lines">@@ -280,7 +280,7 @@
</span><span class="cx">                         $total_groups = $wpdb-&gt;get_var( &quot;SELECT COUNT(DISTINCT g.id) FROM {$bp-&gt;groups-&gt;table_name_groupmeta} gm INNER JOIN {$bp-&gt;groups-&gt;table_name} g ON gm.group_id = g.id WHERE gm.meta_key = 'last_activity'{$hidden_sql} {$search_sql}&quot; );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( empty( $user_id ) ) {
</del><ins>+                if ( !empty( $populate_extras ) ) {
</ins><span class="cx">                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group-&gt;id;
</span><span class="cx">                         $group_ids = $wpdb-&gt;escape( join( ',', (array)$group_ids ) );
</span><span class="cx">                         $paged_groups = BP_Groups_Group::get_group_extras( &amp;$paged_groups, $group_ids, 'newest' );
</span><span class="lines">@@ -289,7 +289,7 @@
</span><span class="cx">                 return array( 'groups' =&gt; $paged_groups, 'total' =&gt; $total_groups );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function get_active( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
</del><ins>+        function get_active( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx"> 
</span><span class="cx">                 if ( $limit &amp;&amp; $page )
</span><span class="lines">@@ -312,7 +312,7 @@
</span><span class="cx">                         $total_groups = $wpdb-&gt;get_var( &quot;SELECT COUNT(DISTINCT g.id) FROM {$bp-&gt;groups-&gt;table_name_groupmeta} gm INNER JOIN {$bp-&gt;groups-&gt;table_name} g ON gm.group_id = g.id WHERE gm.meta_key = 'last_activity'{$hidden_sql} {$search_sql}&quot; );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( empty( $user_id ) ) {
</del><ins>+                if ( !empty( $populate_extras ) ) {
</ins><span class="cx">                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group-&gt;id;
</span><span class="cx">                         $group_ids = $wpdb-&gt;escape( join( ',', (array)$group_ids ) );
</span><span class="cx">                         $paged_groups = BP_Groups_Group::get_group_extras( &amp;$paged_groups, $group_ids, 'newest' );
</span><span class="lines">@@ -321,7 +321,7 @@
</span><span class="cx">                 return array( 'groups' =&gt; $paged_groups, 'total' =&gt; $total_groups );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function get_popular( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
</del><ins>+        function get_popular( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx"> 
</span><span class="cx">                 if ( $limit &amp;&amp; $page ) {
</span><span class="lines">@@ -345,7 +345,7 @@
</span><span class="cx">                         $total_groups = $wpdb-&gt;get_var( &quot;SELECT COUNT(DISTINCT g.id) FROM {$bp-&gt;groups-&gt;table_name_groupmeta} gm1, {$bp-&gt;groups-&gt;table_name_groupmeta} gm2, {$bp-&gt;groups-&gt;table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' {$hidden_sql} {$search_sql}&quot; );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( empty( $user_id ) ) {
</del><ins>+                if ( !empty( $populate_extras ) ) {
</ins><span class="cx">                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group-&gt;id;
</span><span class="cx">                         $group_ids = $wpdb-&gt;escape( join( ',', (array)$group_ids ) );
</span><span class="cx">                         $paged_groups = BP_Groups_Group::get_group_extras( &amp;$paged_groups, $group_ids, 'newest' );
</span><span class="lines">@@ -354,7 +354,7 @@
</span><span class="cx">                 return array( 'groups' =&gt; $paged_groups, 'total' =&gt; $total_groups );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function get_alphabetically( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
</del><ins>+        function get_alphabetically( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx"> 
</span><span class="cx">                 if ( $limit &amp;&amp; $page )
</span><span class="lines">@@ -377,7 +377,7 @@
</span><span class="cx">                         $total_groups = $wpdb-&gt;get_var( &quot;SELECT COUNT(DISTINCT g.id) FROM {$bp-&gt;groups-&gt;table_name_groupmeta} gm1, {$bp-&gt;groups-&gt;table_name_groupmeta} gm2, {$bp-&gt;groups-&gt;table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' {$hidden_sql} {$search_sql}&quot; );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( empty( $user_id ) ) {
</del><ins>+                if ( !empty( $populate_extras ) ) {
</ins><span class="cx">                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group-&gt;id;
</span><span class="cx">                         $group_ids = $wpdb-&gt;escape( join( ',', (array)$group_ids ) );
</span><span class="cx">                         $paged_groups = BP_Groups_Group::get_group_extras( &amp;$paged_groups, $group_ids, 'newest' );
</span><span class="lines">@@ -386,7 +386,7 @@
</span><span class="cx">                 return array( 'groups' =&gt; $paged_groups, 'total' =&gt; $total_groups );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function get_by_most_forum_topics( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
</del><ins>+        function get_by_most_forum_topics( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
</ins><span class="cx">                 global $wpdb, $bp, $bbdb;
</span><span class="cx"> 
</span><span class="cx">                 if ( !$bbdb )
</span><span class="lines">@@ -413,7 +413,7 @@
</span><span class="cx">                         $total_groups = $wpdb-&gt;get_var( &quot;SELECT COUNT(DISTINCT g.id) FROM {$bp-&gt;groups-&gt;table_name_groupmeta} gm1, {$bp-&gt;groups-&gt;table_name_groupmeta} gm2, {$bp-&gt;groups-&gt;table_name_groupmeta} gm3, {$bbdb-&gt;forums} f, {$bp-&gt;groups-&gt;table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.topics &gt; 0 {$hidden_sql} {$search_sql}&quot; );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( empty( $user_id ) ) {
</del><ins>+                if ( !empty( $populate_extras ) ) {
</ins><span class="cx">                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group-&gt;id;
</span><span class="cx">                         $group_ids = $wpdb-&gt;escape( join( ',', (array)$group_ids ) );
</span><span class="cx">                         $paged_groups = BP_Groups_Group::get_group_extras( &amp;$paged_groups, $group_ids, 'newest' );
</span><span class="lines">@@ -422,7 +422,7 @@
</span><span class="cx">                 return array( 'groups' =&gt; $paged_groups, 'total' =&gt; $total_groups );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false ) {
</del><ins>+        function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true ) {
</ins><span class="cx">                 global $wpdb, $bp, $bbdb;
</span><span class="cx"> 
</span><span class="cx">                 if ( !$bbdb )
</span><span class="lines">@@ -449,7 +449,7 @@
</span><span class="cx">                         $total_groups = $wpdb-&gt;get_var( &quot;SELECT COUNT(DISTINCT g.id) FROM {$bp-&gt;groups-&gt;table_name_groupmeta} gm1, {$bp-&gt;groups-&gt;table_name_groupmeta} gm2, {$bp-&gt;groups-&gt;table_name_groupmeta} gm3, {$bbdb-&gt;forums} f, {$bp-&gt;groups-&gt;table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) {$hidden_sql} {$search_sql}&quot; );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( empty( $user_id ) ) {
</del><ins>+                if ( !empty( $populate_extras ) ) {
</ins><span class="cx">                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group-&gt;id;
</span><span class="cx">                         $group_ids = $wpdb-&gt;escape( join( ',', (array)$group_ids ) );
</span><span class="cx">                         $paged_groups = BP_Groups_Group::get_group_extras( &amp;$paged_groups, $group_ids, 'newest' );
</span><span class="lines">@@ -502,7 +502,7 @@
</span><span class="cx">                 return $wpdb-&gt;get_results($sql);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function get_by_letter( $letter, $limit = null, $page = null ) {
</del><ins>+        function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx"> 
</span><span class="cx">                 if ( strlen($letter) &gt; 1 || is_numeric($letter) || !$letter )
</span><span class="lines">@@ -520,7 +520,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $paged_groups = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp-&gt;groups-&gt;table_name_groupmeta} gm1, {$bp-&gt;groups-&gt;table_name_groupmeta} gm2, {$bp-&gt;groups-&gt;table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND g.name LIKE '$letter%%' {$hidden_sql} {$search_sql} ORDER BY g.name ASC {$pag_sql}&quot;  ) );
</span><span class="cx"> 
</span><del>-                if ( empty( $user_id ) ) {
</del><ins>+                if ( !empty( $populate_extras ) ) {
</ins><span class="cx">                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group-&gt;id;
</span><span class="cx">                         $group_ids = $wpdb-&gt;escape( join( ',', (array)$group_ids ) );
</span><span class="cx">                         $paged_groups = BP_Groups_Group::get_group_extras( &amp;$paged_groups, $group_ids, 'newest' );
</span><span class="lines">@@ -529,7 +529,7 @@
</span><span class="cx">                 return array( 'groups' =&gt; $paged_groups, 'total' =&gt; $total_groups );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function get_random( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
</del><ins>+        function get_random( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx"> 
</span><span class="cx">                 if ( $limit &amp;&amp; $page )
</span><span class="lines">@@ -552,7 +552,7 @@
</span><span class="cx">                         $total_groups = $wpdb-&gt;get_var( &quot;SELECT COUNT(DISTINCT g.id) FROM {$bp-&gt;groups-&gt;table_name_groupmeta} gm INNER JOIN {$bp-&gt;groups-&gt;table_name} g ON gm.group_id = g.id WHERE gm.meta_key = 'last_activity'{$hidden_sql} {$search_sql}&quot; );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( empty( $user_id ) ) {
</del><ins>+                if ( !empty( $populate_extras ) ) {
</ins><span class="cx">                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group-&gt;id;
</span><span class="cx">                         $group_ids = $wpdb-&gt;escape( join( ',', (array)$group_ids ) );
</span><span class="cx">                         $paged_groups = BP_Groups_Group::get_group_extras( &amp;$paged_groups, $group_ids, 'newest' );
</span><span class="lines">@@ -764,12 +764,12 @@
</span><span class="cx">         function accept_invite() {
</span><span class="cx">                 $this-&gt;inviter_id = 0;
</span><span class="cx">                 $this-&gt;is_confirmed = 1;
</span><del>-                $this-&gt;date_modified = time();
</del><ins>+                $this-&gt;date_modified = gmdate( &quot;Y-m-d H:i:s&quot; );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function accept_request() {
</span><span class="cx">                 $this-&gt;is_confirmed = 1;
</span><del>-                $this-&gt;date_modified = time();
</del><ins>+                $this-&gt;date_modified = gmdate( &quot;Y-m-d H:i:s&quot; );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /* Static Functions */
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupstemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-templatetags.php (2621 => 2622)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-templatetags.php        2010-02-08 12:12:04 UTC (rev 2621)
+++ trunk/bp-groups/bp-groups-templatetags.php        2010-02-08 12:33:13 UTC (rev 2622)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">         var $sort_by;
</span><span class="cx">         var $order;
</span><span class="cx"> 
</span><del>-        function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms ) {
</del><ins>+        function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras ) {
</ins><span class="cx">                 global $bp;
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page;
</span><span class="lines">@@ -30,33 +30,44 @@
</span><span class="cx"> 
</span><span class="cx">                 switch ( $type ) {
</span><span class="cx">                         case 'active': default:
</span><del>-                                $this-&gt;groups = groups_get_active( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms );
</del><ins>+                                $this-&gt;groups = groups_get_active( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms, $populate_extras );
</ins><span class="cx">                                 break;
</span><span class="cx"> 
</span><span class="cx">                         case 'alphabetical': default:
</span><del>-                                $this-&gt;groups = groups_get_alphabetically( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms );
</del><ins>+                                $this-&gt;groups = groups_get_alphabetically( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms, $populate_extras );
</ins><span class="cx">                                 break;
</span><span class="cx"> 
</span><span class="cx">                         case 'random':
</span><del>-                                $this-&gt;groups = groups_get_random_groups( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms );
</del><ins>+                                $this-&gt;groups = groups_get_random_groups( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms, $populate_extras );
</ins><span class="cx">                                 break;
</span><span class="cx"> 
</span><span class="cx">                         case 'newest':
</span><del>-                                $this-&gt;groups = groups_get_newest( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms );
</del><ins>+                                $this-&gt;groups = groups_get_newest( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms, $populate_extras );
</ins><span class="cx">                                 break;
</span><span class="cx"> 
</span><span class="cx">                         case 'popular':
</span><del>-                                $this-&gt;groups = groups_get_popular( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms );
</del><ins>+                                $this-&gt;groups = groups_get_popular( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms, $populate_extras );
</ins><span class="cx">                                 break;
</span><span class="cx"> 
</span><span class="cx">                         case 'most-forum-topics':
</span><del>-                                $this-&gt;groups = groups_get_by_most_forum_topics( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms );
</del><ins>+                                $this-&gt;groups = groups_get_by_most_forum_topics( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms, $populate_extras );
</ins><span class="cx">                                 break;
</span><span class="cx"> 
</span><span class="cx">                         case 'most-forum-posts':
</span><del>-                                $this-&gt;groups = groups_get_by_most_forum_posts( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms );
</del><ins>+                                $this-&gt;groups = groups_get_by_most_forum_posts( $this-&gt;pag_num, $this-&gt;pag_page, $user_id, $search_terms, $populate_extras );
</ins><span class="cx">                                 break;
</span><span class="cx"> 
</span><ins>+                        case 'invites':
+                                $this-&gt;groups = groups_get_invites_for_user( $user_id, $this-&gt;pag_num, $this-&gt;pag_page );
+                                break;
+
+                        case 'single-group':
+                                $group = new stdClass;
+                                $group-&gt;group_id = BP_Groups_Group::get_id_from_slug($slug);
+                                $this-&gt;groups = array( $group );
+                                break;
+
+
</ins><span class="cx">                         case 'admin-of':
</span><span class="cx">                                 if ( $user_id )
</span><span class="cx">                                         $this-&gt;groups = groups_get_user_is_admin_of( $user_id, $this-&gt;pag_num, $this-&gt;pag_page, $search_terms );
</span><span class="lines">@@ -66,16 +77,6 @@
</span><span class="cx">                                 if ( $user_id )
</span><span class="cx">                                         $this-&gt;groups = groups_get_user_is_mod_of( $user_id, $this-&gt;pag_num, $this-&gt;pag_page, $filter );
</span><span class="cx">                                 break;
</span><del>-
-                        case 'invites':
-                                $this-&gt;groups = groups_get_invites_for_user( $user_id, $this-&gt;pag_num, $this-&gt;pag_page );
-                                break;
-
-                        case 'single-group':
-                                $group = new stdClass;
-                                $group-&gt;group_id = BP_Groups_Group::get_id_from_slug($slug);
-                                $this-&gt;groups = array( $group );
-                                break;
</del><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( 'invites' == $type ) {
</span><span class="lines">@@ -214,13 +215,15 @@
</span><span class="cx"> 
</span><span class="cx">                 'user_id' =&gt; $user_id, // Pass a user ID to limit to groups this user has joined
</span><span class="cx">                 'slug' =&gt; $slug, // Pass a group slug to only return that group
</span><del>-                'search_terms' =&gt; $search_terms // Pass search terms to return only matching groups
</del><ins>+                'search_terms' =&gt; $search_terms, // Pass search terms to return only matching groups
+
+                'populate_extras' =&gt; true // Get extra meta - is_member, is_banned
</ins><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         $r = wp_parse_args( $args, $defaults );
</span><span class="cx">         extract( $r );
</span><span class="cx"> 
</span><del>-        $groups_template = new BP_Groups_Template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms );
</del><ins>+        $groups_template = new BP_Groups_Template( (int)$user_id, $type, (int)$page, (int)$per_page, (int)$max, $slug, $search_terms, (int)$populate_extras );
</ins><span class="cx">         return apply_filters( 'bp_has_groups', $groups_template-&gt;has_groups(), &amp;$groups_template );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1134,6 +1137,9 @@
</span><span class="cx">         if ( !$group-&gt;status )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><ins>+        if ( 'hidden' == $group-&gt;status &amp;&amp; !$group-&gt;is_member )
+                return false;
+
</ins><span class="cx">         echo '&lt;div class=&quot;generic-button group-button ' . $group-&gt;status . '&quot; id=&quot;groupbutton-' . $group-&gt;id . '&quot;&gt;';
</span><span class="cx"> 
</span><span class="cx">         switch ( $group-&gt;status ) {
</span><span class="lines">@@ -1154,6 +1160,11 @@
</span><span class="cx">                                         echo '&lt;a class=&quot;membership-requested&quot; href=&quot;' . bp_get_group_permalink( $group ) . '&quot;&gt;' . __( 'Request Sent', 'buddypress' ) . '&lt;/a&gt;';
</span><span class="cx">                         }
</span><span class="cx">                 break;
</span><ins>+
+                case 'hidden':
+                        if ( $group-&gt;is_member )
+                                echo '&lt;a class=&quot;leave-group&quot; href=&quot;' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '&quot;&gt;' . __( 'Leave Group', 'buddypress' ) . '&lt;/a&gt;';
+                break;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         echo '&lt;/div&gt;';
</span></span></pre></div>
<a id="trunkbpgroupsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups.php (2621 => 2622)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups.php        2010-02-08 12:12:04 UTC (rev 2621)
+++ trunk/bp-groups.php        2010-02-08 12:33:13 UTC (rev 2622)
</span><span class="lines">@@ -2173,6 +2173,10 @@
</span><span class="cx">         if ( !$member-&gt;save() )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><ins>+        /* Modify group meta */
+        groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') + 1 );
+        groups_update_groupmeta( $group_id, 'last_activity', gmdate( &quot;Y-m-d H:i:s&quot; ) );
+
</ins><span class="cx">         do_action( 'groups_accept_invite', $user_id, $group_id );
</span><span class="cx">         return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultactivitypostformphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/activity/post-form.php (2621 => 2622)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/activity/post-form.php        2010-02-08 12:12:04 UTC (rev 2621)
+++ trunk/bp-themes/bp-default/activity/post-form.php        2010-02-08 12:33:13 UTC (rev 2622)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx">                                         &lt;select id=&quot;whats-new-post-in&quot; name=&quot;whats-new-post-in&quot;&gt;
</span><span class="cx">                                                 &lt;option selected=&quot;selected&quot; value=&quot;0&quot;&gt;&lt;?php _e( 'My Profile', 'buddypress' ) ?&gt;&lt;/option&gt;
</span><span class="cx"> 
</span><del>-                                                &lt;?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&amp;type=alphabetical&amp;max=100&amp;per_page=100' ) ) : while ( bp_groups() ) : bp_the_group(); ?&gt;
</del><ins>+                                                &lt;?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&amp;type=alphabetical&amp;max=100&amp;per_page=100&amp;populate_extras=0' ) ) : while ( bp_groups() ) : bp_the_group(); ?&gt;
</ins><span class="cx">                                                         &lt;option value=&quot;&lt;?php bp_group_id() ?&gt;&quot;&gt;&lt;?php bp_group_name() ?&gt;&lt;/option&gt;
</span><span class="cx">                                                 &lt;?php endwhile; endif; ?&gt;
</span><span class="cx">                                         &lt;/select&gt;
</span></span></pre>
</div>
</div>

</body>
</html>