<!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] [2550] trunk: Group member listing and pag fixes.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2550</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-02 22:58:17 +0000 (Tue, 02 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Group member listing and pag fixes.</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="#trunkbpthemesbpdefaultgroupssingleadminphp">trunk/bp-themes/bp-default/groups/single/admin.php</a></li>
<li><a href="#trunkbpthemesbpdefaultgroupssinglemembersphp">trunk/bp-themes/bp-default/groups/single/members.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 (2549 => 2550)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-classes.php        2010-02-02 22:19:14 UTC (rev 2549)
+++ trunk/bp-groups/bp-groups-classes.php        2010-02-02 22:58:17 UTC (rev 2550)
</span><span class="lines">@@ -968,9 +968,9 @@
</span><span class="cx">                         $banned_sql = $wpdb-&gt;prepare( &quot; AND is_banned = 0&quot; );
</span><span class="cx"> 
</span><span class="cx">                 if ( bp_is_active( 'xprofile' ) )
</span><del>-                        $members = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, pd.value as display_name FROM {$bp-&gt;groups-&gt;table_name_members} m, {$wpdb-&gt;users} u, {$bp-&gt;profile-&gt;table_name_data} pd WHERE u.ID = m.user_id AND u.ID = pd.user_id AND pd.field_id = 1 AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} {$pag_sql}&quot;, $group_id ) );
</del><ins>+                        $members = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, pd.value as display_name FROM {$bp-&gt;groups-&gt;table_name_members} m, {$wpdb-&gt;users} u, {$bp-&gt;profile-&gt;table_name_data} pd WHERE u.ID = m.user_id AND u.ID = pd.user_id AND pd.field_id = 1 AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} ORDER BY m.date_modified DESC {$pag_sql}&quot;, $group_id ) );
</ins><span class="cx">                 else
</span><del>-                        $members = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$bp-&gt;groups-&gt;table_name_members} m, {$wpdb-&gt;users} u WHERE u.ID = m.user_id AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} {$pag_sql}&quot;, $group_id ) );
</del><ins>+                        $members = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$bp-&gt;groups-&gt;table_name_members} m, {$wpdb-&gt;users} u WHERE u.ID = m.user_id AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} ORDER BY m.date_modified DESC {$pag_sql}&quot;, $group_id ) );
</ins><span class="cx"> 
</span><span class="cx">                 if ( !$members )
</span><span class="cx">                         return false;
</span><span class="lines">@@ -980,6 +980,20 @@
</span><span class="cx">                 else
</span><span class="cx">                         $total_member_count = $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT COUNT(user_id) FROM {$bp-&gt;groups-&gt;table_name_members} WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql}&quot;, $group_id ) );
</span><span class="cx"> 
</span><ins>+                /* Fetch whether or not the user is a friend */
+                foreach ( $members as $user ) $user_ids[] = $user-&gt;user_id;
+                $user_ids = $wpdb-&gt;escape( join( ',', (array)$user_ids ) );
+
+                if ( function_exists( 'friends_install' ) ) {
+                        $friend_status = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp-&gt;friends-&gt;table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids} ) ) OR (initiator_user_id IN ( {$user_ids} ) AND friend_user_id = %d )&quot;, $bp-&gt;loggedin_user-&gt;id, $bp-&gt;loggedin_user-&gt;id ) );
+                        for ( $i = 0; $i &lt; count( $members ); $i++ ) {
+                                foreach ( $friend_status as $status ) {
+                                        if ( $status-&gt;initiator_user_id == $members[$i]-&gt;user_id || $status-&gt;friend_user_id == $members[$i]-&gt;user_id )
+                                                $members[$i]-&gt;is_friend = $status-&gt;is_confirmed;
+                                }
+                        }
+                }
+
</ins><span class="cx">                 return array( 'members' =&gt; $members, 'count' =&gt; $total_member_count );
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupstemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-templatetags.php (2549 => 2550)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-templatetags.php        2010-02-02 22:19:14 UTC (rev 2549)
+++ trunk/bp-groups/bp-groups-templatetags.php        2010-02-02 22:58:17 UTC (rev 2550)
</span><span class="lines">@@ -1323,7 +1323,7 @@
</span><span class="cx"> 
</span><span class="cx">         $defaults = array(
</span><span class="cx">                 'group_id' =&gt; $bp-&gt;groups-&gt;current_group-&gt;id,
</span><del>-                'per_page' =&gt; 10,
</del><ins>+                'per_page' =&gt; 20,
</ins><span class="cx">                 'max' =&gt; false,
</span><span class="cx">                 'exclude_admins_mods' =&gt; 1,
</span><span class="cx">                 'exclude_banned' =&gt; 1
</span><span class="lines">@@ -1402,6 +1402,20 @@
</span><span class="cx">                 return apply_filters( 'bp_get_group_member_link', '&lt;a href=&quot;' . bp_core_get_user_domain( $members_template-&gt;member-&gt;user_id, $members_template-&gt;member-&gt;user_nicename, $members_template-&gt;member-&gt;user_login ) . '&quot;&gt;' . $members_template-&gt;member-&gt;display_name . '&lt;/a&gt;' );
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+function bp_group_member_is_friend() {
+        echo bp_get_group_member_is_friend();
+}
+        function bp_get_group_member_is_friend() {
+                global $members_template;
+
+                if ( null === $members_template-&gt;member-&gt;is_friend )
+                        $friend_status = 'not_friends';
+                else
+                        $friend_status = ( 0 == $members_template-&gt;member-&gt;is_friend ) ? 'pending' : 'is_friend';
+
+                return apply_filters( 'bp_get_group_member_is_friend', $friend_status );
+        }
+
</ins><span class="cx"> function bp_group_member_is_banned() {
</span><span class="cx">         echo bp_get_group_member_is_banned();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultgroupssingleadminphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/groups/single/admin.php (2549 => 2550)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/groups/single/admin.php        2010-02-02 22:19:14 UTC (rev 2549)
+++ trunk/bp-themes/bp-default/groups/single/admin.php        2010-02-02 22:58:17 UTC (rev 2550)
</span><span class="lines">@@ -177,7 +177,7 @@
</span><span class="cx"> 
</span><span class="cx">                         &lt;?php if ( bp_group_member_needs_pagination() ) : ?&gt;
</span><span class="cx"> 
</span><del>-                                &lt;div class=&quot;pagination&quot;&gt;
</del><ins>+                                &lt;div class=&quot;pagination no-ajax&quot;&gt;
</ins><span class="cx"> 
</span><span class="cx">                                         &lt;div id=&quot;member-count&quot; class=&quot;pag-count&quot;&gt;
</span><span class="cx">                                                 &lt;?php bp_group_member_pagination_count() ?&gt;
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultgroupssinglemembersphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/groups/single/members.php (2549 => 2550)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/groups/single/members.php        2010-02-02 22:19:14 UTC (rev 2549)
+++ trunk/bp-themes/bp-default/groups/single/members.php        2010-02-02 22:58:17 UTC (rev 2550)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> 
</span><span class="cx">         &lt;?php do_action( 'bp_before_group_members_content' ) ?&gt;
</span><span class="cx"> 
</span><del>-        &lt;div class=&quot;pagination&quot;&gt;
</del><ins>+        &lt;div class=&quot;pagination no-ajax&quot;&gt;
</ins><span class="cx"> 
</span><span class="cx">                 &lt;div id=&quot;member-count&quot; class=&quot;pag-count&quot;&gt;
</span><span class="cx">                         &lt;?php bp_group_member_pagination_count() ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>