<!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] [2337] trunk: Fixing friend invite listing.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2337</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-01-18 15:00:20 +0000 (Mon, 18 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixing friend invite listing.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpfriendsphp">trunk/bp-friends.php</a></li>
<li><a href="#trunkbpthemesbpdefault_inccssdefaultcss">trunk/bp-themes/bp-default/_inc/css/default.css</a></li>
<li><a href="#trunkbpthemesbpdefaultgroupscreatephp">trunk/bp-themes/bp-default/groups/create.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpfriendsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends.php (2336 => 2337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends.php        2010-01-18 14:11:11 UTC (rev 2336)
+++ trunk/bp-friends.php        2010-01-18 15:00:20 UTC (rev 2337)
</span><span class="lines">@@ -537,65 +537,22 @@
</span><span class="cx">         return BP_Friends_Friendship::get_bulk_last_active( $friend_ids );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function friends_get_friends_list( $user_id ) {
-        global $bp;
-
-        $friend_ids = BP_Friends_Friendship::get_friend_user_ids( $user_id );
-
-        if ( !$friend_ids )
-                return false;
-
-        for ( $i = 0; $i &lt; count($friend_ids); $i++ ) {
-                if ( function_exists('bp_user_fullname') )
-                        $display_name = bp_core_get_user_displayname( $friend_ids[$i] );
-
-                if ( $display_name != ' ' ) {
-                        $friends[] = array(
-                                'id' =&gt; $friend_ids[$i],
-                                'full_name' =&gt; $display_name
-                        );
-                }
-        }
-
-        if ( $friends &amp;&amp; is_array($friends) )
-                usort($friends, 'friends_sort_by_name');
-
-        if ( !$friends )
-                return false;
-
-        return $friends;
-}
-
-        function friends_sort_by_name($a, $b) {
-            return strcasecmp($a['full_name'], $b['full_name']);
-        }
-
</del><span class="cx"> function friends_get_friends_invite_list( $user_id = false, $group_id ) {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><span class="cx">         if ( !$user_id )
</span><span class="cx">                 $user_id = $bp-&gt;loggedin_user-&gt;id;
</span><span class="cx"> 
</span><del>-        $friend_ids = friends_get_alphabetically( $user_id );
-
-        if ( (int) $friend_ids['total'] &lt; 1 )
-                return false;
-
-        for ( $i = 0; $i &lt; count($friend_ids['friends']); $i++ ) {
-                if ( groups_check_user_has_invite( $friend_ids['friends'][$i]-&gt;user_id, $group_id ) || groups_is_user_member( $friend_ids['friends'][$i]-&gt;user_id, $group_id ) )
-                        continue;
-
-                $display_name = bp_core_get_user_displayname( $friend_ids['friends'][$i]-&gt;user_id );
-
-                if ( $display_name != ' ' ) {
</del><ins>+        if ( bp_has_members( 'user_id=' . $user_id . '&amp;type=alphabetical&amp;per_page=0' ) ) {
+                while ( bp_members() ) : bp_the_member();
</ins><span class="cx">                         $friends[] = array(
</span><del>-                                'id' =&gt; $friend_ids['friends'][$i]-&gt;user_id,
-                                'full_name' =&gt; $display_name
</del><ins>+                                'id' =&gt; bp_get_member_user_id(),
+                                'full_name' =&gt; bp_get_member_name()
</ins><span class="cx">                         );
</span><del>-                }
</del><ins>+                endwhile;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ( !$friends )
</del><ins>+        if ( empty($friends) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         return $friends;
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_inccssdefaultcss"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/css/default.css (2336 => 2337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/css/default.css        2010-01-18 14:11:11 UTC (rev 2336)
+++ trunk/bp-themes/bp-default/_inc/css/default.css        2010-01-18 15:00:20 UTC (rev 2337)
</span><span class="lines">@@ -771,9 +771,8 @@
</span><span class="cx"> form#send-invite-form {
</span><span class="cx">         margin-top: 20px;
</span><span class="cx"> }
</span><del>-
-        form#send-invite-form #invite-list {
-                height: 275px;
</del><ins>+        div#invite-list {
+                height: 400px;
</ins><span class="cx">                 overflow: auto;
</span><span class="cx">                 -moz-border-radius: 3px;
</span><span class="cx">                 -webkit-border-radius: 3px;
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultgroupscreatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/groups/create.php (2336 => 2337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/groups/create.php        2010-01-18 14:11:11 UTC (rev 2336)
+++ trunk/bp-themes/bp-default/groups/create.php        2010-01-18 15:00:20 UTC (rev 2337)
</span><span class="lines">@@ -157,51 +157,60 @@
</span><span class="cx"> 
</span><span class="cx">                                         &lt;?php do_action( 'bp_before_group_invites_creation_step' ); ?&gt;
</span><span class="cx"> 
</span><del>-                                        &lt;div class=&quot;left-menu&quot;&gt;
</del><ins>+                                        &lt;?php if ( bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?&gt;
+                                                &lt;div class=&quot;left-menu&quot;&gt;
</ins><span class="cx"> 
</span><del>-                                                &lt;div id=&quot;invite-list&quot;&gt;
-                                                        &lt;ul&gt;
-                                                                &lt;?php bp_new_group_invite_friend_list() ?&gt;
-                                                        &lt;/ul&gt;
</del><ins>+                                                        &lt;div id=&quot;invite-list&quot;&gt;
+                                                                &lt;ul&gt;
+                                                                        &lt;?php bp_new_group_invite_friend_list() ?&gt;
+                                                                &lt;/ul&gt;
</ins><span class="cx"> 
</span><del>-                                                        &lt;?php wp_nonce_field( 'groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user' ) ?&gt;
-                                                &lt;/div&gt;
</del><ins>+                                                                &lt;?php wp_nonce_field( 'groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user' ) ?&gt;
+                                                        &lt;/div&gt;
</ins><span class="cx"> 
</span><del>-                                        &lt;/div&gt;&lt;!-- .left-menu --&gt;
</del><ins>+                                                &lt;/div&gt;&lt;!-- .left-menu --&gt;
</ins><span class="cx"> 
</span><del>-                                        &lt;div class=&quot;main-column&quot;&gt;
</del><ins>+                                                &lt;div class=&quot;main-column&quot;&gt;
</ins><span class="cx"> 
</span><del>-                                                &lt;div id=&quot;message&quot; class=&quot;info&quot;&gt;
-                                                        &lt;p&gt;&lt;?php _e('Select people to invite from your friends list.', 'buddypress'); ?&gt;&lt;/p&gt;
-                                                &lt;/div&gt;
</del><ins>+                                                        &lt;div id=&quot;message&quot; class=&quot;info&quot;&gt;
+                                                                &lt;p&gt;&lt;?php _e('Select people to invite from your friends list.', 'buddypress'); ?&gt;&lt;/p&gt;
+                                                        &lt;/div&gt;
</ins><span class="cx"> 
</span><del>-                                                &lt;?php /* The ID 'friend-list' is important for AJAX support. */ ?&gt;
-                                                &lt;ul id=&quot;friend-list&quot; class=&quot;item-list&quot;&gt;
-                                                &lt;?php if ( bp_group_has_invites() ) : ?&gt;
</del><ins>+                                                        &lt;?php /* The ID 'friend-list' is important for AJAX support. */ ?&gt;
+                                                        &lt;ul id=&quot;friend-list&quot; class=&quot;item-list&quot;&gt;
+                                                        &lt;?php if ( bp_group_has_invites() ) : ?&gt;
</ins><span class="cx"> 
</span><del>-                                                        &lt;?php while ( bp_group_invites() ) : bp_group_the_invite(); ?&gt;
</del><ins>+                                                                &lt;?php while ( bp_group_invites() ) : bp_group_the_invite(); ?&gt;
</ins><span class="cx"> 
</span><del>-                                                                &lt;li id=&quot;&lt;?php bp_group_invite_item_id() ?&gt;&quot;&gt;
-                                                                        &lt;?php bp_group_invite_user_avatar() ?&gt;
</del><ins>+                                                                        &lt;li id=&quot;&lt;?php bp_group_invite_item_id() ?&gt;&quot;&gt;
+                                                                                &lt;?php bp_group_invite_user_avatar() ?&gt;
</ins><span class="cx"> 
</span><del>-                                                                        &lt;h4&gt;&lt;?php bp_group_invite_user_link() ?&gt;&lt;/h4&gt;
-                                                                        &lt;span class=&quot;activity&quot;&gt;&lt;?php bp_group_invite_user_last_active() ?&gt;&lt;/span&gt;
</del><ins>+                                                                                &lt;h4&gt;&lt;?php bp_group_invite_user_link() ?&gt;&lt;/h4&gt;
+                                                                                &lt;span class=&quot;activity&quot;&gt;&lt;?php bp_group_invite_user_last_active() ?&gt;&lt;/span&gt;
</ins><span class="cx"> 
</span><del>-                                                                        &lt;div class=&quot;action&quot;&gt;
-                                                                                &lt;a class=&quot;remove&quot; href=&quot;&lt;?php bp_group_invite_user_remove_invite_url() ?&gt;&quot; id=&quot;&lt;?php bp_group_invite_item_id() ?&gt;&quot;&gt;&lt;?php _e( 'Remove Invite', 'buddypress' ) ?&gt;&lt;/a&gt;
-                                                                        &lt;/div&gt;
-                                                                &lt;/li&gt;
</del><ins>+                                                                                &lt;div class=&quot;action&quot;&gt;
+                                                                                        &lt;a class=&quot;remove&quot; href=&quot;&lt;?php bp_group_invite_user_remove_invite_url() ?&gt;&quot; id=&quot;&lt;?php bp_group_invite_item_id() ?&gt;&quot;&gt;&lt;?php _e( 'Remove Invite', 'buddypress' ) ?&gt;&lt;/a&gt;
+                                                                                &lt;/div&gt;
+                                                                        &lt;/li&gt;
</ins><span class="cx"> 
</span><del>-                                                        &lt;?php endwhile; ?&gt;
</del><ins>+                                                                &lt;?php endwhile; ?&gt;
</ins><span class="cx"> 
</span><del>-                                                        &lt;?php wp_nonce_field( 'groups_send_invites', '_wpnonce_send_invites' ) ?&gt;
-                                                &lt;?php endif; ?&gt;
-                                                &lt;/ul&gt;
</del><ins>+                                                                &lt;?php wp_nonce_field( 'groups_send_invites', '_wpnonce_send_invites' ) ?&gt;
+                                                        &lt;?php endif; ?&gt;
+                                                        &lt;/ul&gt;
</ins><span class="cx"> 
</span><del>-                                                &lt;?php wp_nonce_field( 'groups_create_save_group-invites' ) ?&gt;
</del><ins>+                                                        &lt;?php wp_nonce_field( 'groups_create_save_group-invites' ) ?&gt;
</ins><span class="cx"> 
</span><del>-                                        &lt;/div&gt;&lt;!-- .main-column --&gt;
</del><ins>+                                                &lt;/div&gt;&lt;!-- .main-column --&gt;
</ins><span class="cx"> 
</span><ins>+                                        &lt;?php else : ?&gt;
+
+                                                &lt;div id=&quot;message&quot; class=&quot;info&quot;&gt;
+                                                        &lt;p&gt;&lt;?php _e( 'Once you have built up friend connections you will be able to invite others to your group. You can send invites any time in the future by selecting the &quot;Send Invites&quot; option when viewing your new group.', 'buddypress' ); ?&gt;&lt;/p&gt;
+                                                &lt;/div&gt;
+
+                                        &lt;?php endif; ?&gt;
+
</ins><span class="cx">                                         &lt;?php do_action( 'bp_after_group_invites_creation_step' ); ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;?php endif; ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>