<!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->prepare( " AND is_banned = 0" );
</span><span class="cx">
</span><span class="cx">                 if ( bp_is_active( 'xprofile' ) )
</span><del>-                        $members = $wpdb->get_results( $wpdb->prepare( "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->groups->table_name_members} m, {$wpdb->users} u, {$bp->profile->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}", $group_id ) );
</del><ins>+                        $members = $wpdb->get_results( $wpdb->prepare( "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->groups->table_name_members} m, {$wpdb->users} u, {$bp->profile->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}", $group_id ) );
</ins><span class="cx">                 else
</span><del>-                        $members = $wpdb->get_results( $wpdb->prepare( "SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$bp->groups->table_name_members} m, {$wpdb->users} u WHERE u.ID = m.user_id AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} {$pag_sql}", $group_id ) );
</del><ins>+                        $members = $wpdb->get_results( $wpdb->prepare( "SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$bp->groups->table_name_members} m, {$wpdb->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}", $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->get_var( $wpdb->prepare( "SELECT COUNT(user_id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql}", $group_id ) );
</span><span class="cx">
</span><ins>+                /* Fetch whether or not the user is a friend */
+                foreach ( $members as $user ) $user_ids[] = $user->user_id;
+                $user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
+
+                if ( function_exists( 'friends_install' ) ) {
+                        $friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->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 )", $bp->loggedin_user->id, $bp->loggedin_user->id ) );
+                        for ( $i = 0; $i < count( $members ); $i++ ) {
+                                foreach ( $friend_status as $status ) {
+                                        if ( $status->initiator_user_id == $members[$i]->user_id || $status->friend_user_id == $members[$i]->user_id )
+                                                $members[$i]->is_friend = $status->is_confirmed;
+                                }
+                        }
+                }
+
</ins><span class="cx">                 return array( 'members' => $members, 'count' => $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' => $bp->groups->current_group->id,
</span><del>-                'per_page' => 10,
</del><ins>+                'per_page' => 20,
</ins><span class="cx">                 'max' => false,
</span><span class="cx">                 'exclude_admins_mods' => 1,
</span><span class="cx">                 'exclude_banned' => 1
</span><span class="lines">@@ -1402,6 +1402,20 @@
</span><span class="cx">                 return apply_filters( 'bp_get_group_member_link', '<a href="' . bp_core_get_user_domain( $members_template->member->user_id, $members_template->member->user_nicename, $members_template->member->user_login ) . '">' . $members_template->member->display_name . '</a>' );
</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->member->is_friend )
+                        $friend_status = 'not_friends';
+                else
+                        $friend_status = ( 0 == $members_template->member->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">                         <?php if ( bp_group_member_needs_pagination() ) : ?>
</span><span class="cx">
</span><del>-                                <div class="pagination">
</del><ins>+                                <div class="pagination no-ajax">
</ins><span class="cx">
</span><span class="cx">                                         <div id="member-count" class="pag-count">
</span><span class="cx">                                                 <?php bp_group_member_pagination_count() ?>
</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">         <?php do_action( 'bp_before_group_members_content' ) ?>
</span><span class="cx">
</span><del>-        <div class="pagination">
</del><ins>+        <div class="pagination no-ajax">
</ins><span class="cx">
</span><span class="cx">                 <div id="member-count" class="pag-count">
</span><span class="cx">                         <?php bp_group_member_pagination_count() ?>
</span></span></pre>
</div>
</div>
</body>
</html>