<!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 < 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' => $friend_ids[$i],
-                                'full_name' => $display_name
-                        );
-                }
-        }
-
-        if ( $friends && 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->loggedin_user->id;
</span><span class="cx">
</span><del>-        $friend_ids = friends_get_alphabetically( $user_id );
-
-        if ( (int) $friend_ids['total'] < 1 )
-                return false;
-
-        for ( $i = 0; $i < count($friend_ids['friends']); $i++ ) {
-                if ( groups_check_user_has_invite( $friend_ids['friends'][$i]->user_id, $group_id ) || groups_is_user_member( $friend_ids['friends'][$i]->user_id, $group_id ) )
-                        continue;
-
-                $display_name = bp_core_get_user_displayname( $friend_ids['friends'][$i]->user_id );
-
-                if ( $display_name != ' ' ) {
</del><ins>+        if ( bp_has_members( 'user_id=' . $user_id . '&type=alphabetical&per_page=0' ) ) {
+                while ( bp_members() ) : bp_the_member();
</ins><span class="cx">                         $friends[] = array(
</span><del>-                                'id' => $friend_ids['friends'][$i]->user_id,
-                                'full_name' => $display_name
</del><ins>+                                'id' => bp_get_member_user_id(),
+                                'full_name' => 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">                                         <?php do_action( 'bp_before_group_invites_creation_step' ); ?>
</span><span class="cx">
</span><del>-                                        <div class="left-menu">
</del><ins>+                                        <?php if ( bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
+                                                <div class="left-menu">
</ins><span class="cx">
</span><del>-                                                <div id="invite-list">
-                                                        <ul>
-                                                                <?php bp_new_group_invite_friend_list() ?>
-                                                        </ul>
</del><ins>+                                                        <div id="invite-list">
+                                                                <ul>
+                                                                        <?php bp_new_group_invite_friend_list() ?>
+                                                                </ul>
</ins><span class="cx">
</span><del>-                                                        <?php wp_nonce_field( 'groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user' ) ?>
-                                                </div>
</del><ins>+                                                                <?php wp_nonce_field( 'groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user' ) ?>
+                                                        </div>
</ins><span class="cx">
</span><del>-                                        </div><!-- .left-menu -->
</del><ins>+                                                </div><!-- .left-menu -->
</ins><span class="cx">
</span><del>-                                        <div class="main-column">
</del><ins>+                                                <div class="main-column">
</ins><span class="cx">
</span><del>-                                                <div id="message" class="info">
-                                                        <p><?php _e('Select people to invite from your friends list.', 'buddypress'); ?></p>
-                                                </div>
</del><ins>+                                                        <div id="message" class="info">
+                                                                <p><?php _e('Select people to invite from your friends list.', 'buddypress'); ?></p>
+                                                        </div>
</ins><span class="cx">
</span><del>-                                                <?php /* The ID 'friend-list' is important for AJAX support. */ ?>
-                                                <ul id="friend-list" class="item-list">
-                                                <?php if ( bp_group_has_invites() ) : ?>
</del><ins>+                                                        <?php /* The ID 'friend-list' is important for AJAX support. */ ?>
+                                                        <ul id="friend-list" class="item-list">
+                                                        <?php if ( bp_group_has_invites() ) : ?>
</ins><span class="cx">
</span><del>-                                                        <?php while ( bp_group_invites() ) : bp_group_the_invite(); ?>
</del><ins>+                                                                <?php while ( bp_group_invites() ) : bp_group_the_invite(); ?>
</ins><span class="cx">
</span><del>-                                                                <li id="<?php bp_group_invite_item_id() ?>">
-                                                                        <?php bp_group_invite_user_avatar() ?>
</del><ins>+                                                                        <li id="<?php bp_group_invite_item_id() ?>">
+                                                                                <?php bp_group_invite_user_avatar() ?>
</ins><span class="cx">
</span><del>-                                                                        <h4><?php bp_group_invite_user_link() ?></h4>
-                                                                        <span class="activity"><?php bp_group_invite_user_last_active() ?></span>
</del><ins>+                                                                                <h4><?php bp_group_invite_user_link() ?></h4>
+                                                                                <span class="activity"><?php bp_group_invite_user_last_active() ?></span>
</ins><span class="cx">
</span><del>-                                                                        <div class="action">
-                                                                                <a class="remove" href="<?php bp_group_invite_user_remove_invite_url() ?>" id="<?php bp_group_invite_item_id() ?>"><?php _e( 'Remove Invite', 'buddypress' ) ?></a>
-                                                                        </div>
-                                                                </li>
</del><ins>+                                                                                <div class="action">
+                                                                                        <a class="remove" href="<?php bp_group_invite_user_remove_invite_url() ?>" id="<?php bp_group_invite_item_id() ?>"><?php _e( 'Remove Invite', 'buddypress' ) ?></a>
+                                                                                </div>
+                                                                        </li>
</ins><span class="cx">
</span><del>-                                                        <?php endwhile; ?>
</del><ins>+                                                                <?php endwhile; ?>
</ins><span class="cx">
</span><del>-                                                        <?php wp_nonce_field( 'groups_send_invites', '_wpnonce_send_invites' ) ?>
-                                                <?php endif; ?>
-                                                </ul>
</del><ins>+                                                                <?php wp_nonce_field( 'groups_send_invites', '_wpnonce_send_invites' ) ?>
+                                                        <?php endif; ?>
+                                                        </ul>
</ins><span class="cx">
</span><del>-                                                <?php wp_nonce_field( 'groups_create_save_group-invites' ) ?>
</del><ins>+                                                        <?php wp_nonce_field( 'groups_create_save_group-invites' ) ?>
</ins><span class="cx">
</span><del>-                                        </div><!-- .main-column -->
</del><ins>+                                                </div><!-- .main-column -->
</ins><span class="cx">
</span><ins>+                                        <?php else : ?>
+
+                                                <div id="message" class="info">
+                                                        <p><?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 "Send Invites" option when viewing your new group.', 'buddypress' ); ?></p>
+                                                </div>
+
+                                        <?php endif; ?>
+
</ins><span class="cx">                                         <?php do_action( 'bp_after_group_invites_creation_step' ); ?>
</span><span class="cx">
</span><span class="cx">                                 <?php endif; ?>
</span></span></pre>
</div>
</div>
</body>
</html>