<!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" />
<title>[BuddyPress][5709] trunk/bp-friends/bp-friends-classes.php: PHP5'ize bp-friends-classes.php - Set methods as public, private, static, and kill off PHP4 constructors.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/5709">5709</a></dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2012-02-11 04:25:41 +0000 (Sat, 11 Feb 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>PHP5'ize bp-friends-classes.php - Set methods as public, private, static, and kill off PHP4 constructors.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpfriendsbpfriendsclassesphp">trunk/bp-friends/bp-friends-classes.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpfriendsbpfriendsclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends/bp-friends-classes.php (5708 => 5709)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends/bp-friends-classes.php        2012-02-11 04:18:44 UTC (rev 5708)
+++ trunk/bp-friends/bp-friends-classes.php        2012-02-11 04:25:41 UTC (rev 5709)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><span class="cx"> <?php
</span><ins>+
</ins><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx">
</span><span class="lines">@@ -15,22 +16,18 @@
</span><span class="cx">
</span><span class="cx">         var $friend;
</span><span class="cx">
</span><del>-        function bp_friends_friendship( $id = null, $is_request = false, $populate_friend_details = true ) {
-                $this->__construct( $id, $is_request, $populate_friend_details );
-        }
-
-        function __construct( $id = null, $is_request = false, $populate_friend_details = true ) {
</del><ins>+        public function __construct( $id = null, $is_request = false, $populate_friend_details = true ) {
</ins><span class="cx">                 $this->is_request = $is_request;
</span><span class="cx">
</span><del>-                if ( $id ) {
-                        $this->id = $id;
</del><ins>+                if ( !empty( $id ) ) {
+                        $this->id = $id;
</ins><span class="cx">                         $this->populate_friend_details = $populate_friend_details;
</span><span class="cx">                         $this->populate( $this->id );
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function populate() {
-                global $wpdb, $bp, $creds;
</del><ins>+        private function populate() {
+                global $wpdb, $bp;
</ins><span class="cx">
</span><span class="cx">                 if ( $friendship = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) ) ) {
</span><span class="cx">                         $this->initiator_user_id = $friendship->initiator_user_id;
</span><span class="lines">@@ -40,11 +37,7 @@
</span><span class="cx">                         $this->date_created = $friendship->date_created;
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                // if running from ajax.
-                if ( !bp_displayed_user_id() )
-                        $bp->displayed_user->id = $creds['current_userid'];
-
-                if ( $this->populate_friend_details ) {
</del><ins>+                if ( !empty( $this->populate_friend_details ) ) {
</ins><span class="cx">                         if ( $this->friend_user_id == bp_displayed_user_id() ) {
</span><span class="cx">                                 $this->friend = new BP_Core_User( $this->initiator_user_id );
</span><span class="cx">                         } else {
</span><span class="lines">@@ -53,7 +46,7 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function save() {
</del><ins>+        public function save() {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 $this->initiator_user_id = apply_filters( 'friends_friendship_initiator_user_id_before_save', $this->initiator_user_id, $this->id );
</span><span class="lines">@@ -64,11 +57,12 @@
</span><span class="cx">
</span><span class="cx">                 do_action_ref_array( 'friends_friendship_before_save', array( &$this ) );
</span><span class="cx">
</span><del>-                if ( $this->id ) {
-                        // Update
</del><ins>+                // Update
+                if (!empty( $this->id ) ) {
</ins><span class="cx">                         $result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = %s ) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );
</span><ins>+
+                // Save
</ins><span class="cx">                 } else {
</span><del>-                        // Save
</del><span class="cx">                         $result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->friends->table_name} ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, %s )", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) );
</span><span class="cx">                         $this->id = $wpdb->insert_id;
</span><span class="cx">                 }
</span><span class="lines">@@ -78,18 +72,18 @@
</span><span class="cx">                 return $result;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function delete() {
</del><ins>+        public function delete() {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        /* Static Functions */
</del><ins>+        /** Static Methods ********************************************************/
</ins><span class="cx">
</span><del>-        function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) {
</del><ins>+        public static function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><del>-                if ( $friend_requests_only ) {
</del><ins>+                if ( !empty( $friend_requests_only ) ) {
</ins><span class="cx">                         $oc_sql = $wpdb->prepare( "AND is_confirmed = 0" );
</span><span class="cx">                         $friend_sql = $wpdb->prepare ( " WHERE friend_user_id = %d", $user_id );
</span><span class="cx">                 } else {
</span><span class="lines">@@ -101,31 +95,32 @@
</span><span class="cx">                 $fids = array();
</span><span class="cx">
</span><span class="cx">                 for ( $i = 0, $count = count( $friends ); $i < $count; ++$i ) {
</span><del>-                        if ( $assoc_arr )
</del><ins>+                        if ( !empty( $assoc_arr ) ) {
</ins><span class="cx">                                 $fids[] = array( 'user_id' => ( $friends[$i]->friend_user_id == $user_id ) ? $friends[$i]->initiator_user_id : $friends[$i]->friend_user_id );
</span><del>-                        else
</del><ins>+                        } else {
</ins><span class="cx">                                 $fids[] = ( $friends[$i]->friend_user_id == $user_id ) ? $friends[$i]->initiator_user_id : $friends[$i]->friend_user_id;
</span><ins>+                        }
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 return $fids;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function get_friendship_id( $user_id, $friend_id ) {
</del><ins>+        public static function get_friendship_id( $user_id, $friend_id ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->friends->table_name} WHERE ( initiator_user_id = %d AND friend_user_id = %d ) OR ( initiator_user_id = %d AND friend_user_id = %d ) AND is_confirmed = 1", $user_id, $friend_id, $friend_id, $user_id ) );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function get_friendship_request_user_ids( $user_id ) {
</del><ins>+        public static function get_friendship_request_user_ids( $user_id ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 return $wpdb->get_col( $wpdb->prepare( "SELECT initiator_user_id FROM {$bp->friends->table_name} WHERE friend_user_id = %d AND is_confirmed = 0", $user_id ) );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function total_friend_count( $user_id = 0 ) {
</del><ins>+        public static function total_friend_count( $user_id = 0 ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><del>-                if ( !$user_id )
</del><ins>+                if ( empty( $user_id ) )
</ins><span class="cx">                         $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
</span><span class="cx">
</span><span class="cx">                 /* This is stored in 'total_friend_count' usermeta.
</span><span class="lines">@@ -134,24 +129,24 @@
</span><span class="cx">                 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1", $user_id, $user_id ) );
</span><span class="cx">
</span><span class="cx">                 // Do not update meta if user has never had friends
</span><del>-                if ( !$count && !bp_get_user_meta( $user_id, 'total_friend_count', true ) )
</del><ins>+                if ( empty( $count ) && !bp_get_user_meta( $user_id, 'total_friend_count', true ) )
</ins><span class="cx">                         return 0;
</span><span class="cx">
</span><span class="cx">                 bp_update_user_meta( $user_id, 'total_friend_count', (int)$count );
</span><del>-                return (int)$count;
</del><ins>+                return (int) $count;
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        function search_friends( $filter, $user_id, $limit = null, $page = null ) {
</del><ins>+        public static function search_friends( $filter, $user_id, $limit = null, $page = null ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 // TODO: Optimize this function.
</span><span class="cx">
</span><del>-                if ( !$user_id )
</del><ins>+                if ( empty( $user_id ) )
</ins><span class="cx">                         $user_id = bp_loggedin_user_id();
</span><span class="cx">
</span><span class="cx">                 $filter = like_escape( $wpdb->escape( $filter ) );
</span><span class="cx">
</span><del>-                if ( $limit && $page )
</del><ins>+                if ( !empty( $limit ) && !empty( $page ) )
</ins><span class="cx">                         $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
</span><span class="cx">
</span><span class="cx">                 if ( !$friend_ids = BP_Friends_Friendship::get_friend_user_ids( $user_id ) )
</span><span class="lines">@@ -160,7 +155,7 @@
</span><span class="cx">                 // Get all the user ids for the current user's friends.
</span><span class="cx">                 $fids = implode( ',', $friend_ids );
</span><span class="cx">
</span><del>-                if ( empty($fids) )
</del><ins>+                if ( empty( $fids ) )
</ins><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 // filter the user_ids based on the search criteria.
</span><span class="lines">@@ -172,25 +167,25 @@
</span><span class="cx">                         $total_sql = "SELECT COUNT(DISTINCT user_id) FROM {$wpdb->usermeta} WHERE user_id IN ($fids) AND meta_key = 'nickname' AND meta_value LIKE '$filter%%'";
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $filtered_friend_ids = $wpdb->get_col($sql);
-                $total_friend_ids = $wpdb->get_var($total_sql);
</del><ins>+                $filtered_friend_ids = $wpdb->get_col( $sql );
+                $total_friend_ids = $wpdb->get_var( $total_sql );
</ins><span class="cx">
</span><del>-                if ( !$filtered_friend_ids )
</del><ins>+                if ( empty( $filtered_friend_ids ) )
</ins><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 return array( 'friends' => $filtered_friend_ids, 'total' => (int)$total_friend_ids );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function check_is_friend( $loggedin_userid, $possible_friend_userid ) {
</del><ins>+        public static function check_is_friend( $loggedin_userid, $possible_friend_userid ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><del>-                if ( !$loggedin_userid || !$possible_friend_userid )
</del><ins>+                if ( empty( $loggedin_userid ) || empty( $possible_friend_userid ) )
</ins><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 $result = $wpdb->get_results( $wpdb->prepare( "SELECT id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id = %d) OR (initiator_user_id = %d AND friend_user_id = %d)", $loggedin_userid, $possible_friend_userid, $possible_friend_userid, $loggedin_userid ) );
</span><span class="cx">
</span><del>-                if ( $result ) {
-                        if ( 0 == (int)$result[0]->is_confirmed ) {
</del><ins>+                if ( !empty( $result ) ) {
+                        if ( 0 == (int) $result[0]->is_confirmed ) {
</ins><span class="cx">                                 return 'pending';
</span><span class="cx">                         } else {
</span><span class="cx">                                 return 'is_friend';
</span><span class="lines">@@ -200,33 +195,33 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function get_bulk_last_active( $user_ids ) {
-                global $wpdb, $bp;
</del><ins>+        public static function get_bulk_last_active( $user_ids ) {
+                global $wpdb;
</ins><span class="cx">
</span><span class="cx">                 return $wpdb->get_results( $wpdb->prepare( "SELECT meta_value as last_activity, user_id FROM {$wpdb->usermeta} WHERE meta_key = %s AND user_id IN ( {$user_ids} ) ORDER BY meta_value DESC", bp_get_user_meta_key( 'last_activity' ) ) );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function accept($friendship_id) {
</del><ins>+        public static function accept($friendship_id) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                  return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = %s WHERE id = %d AND friend_user_id = %d", bp_core_current_time(), $friendship_id, bp_loggedin_user_id() ) );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function reject($friendship_id) {
</del><ins>+        public static function reject($friendship_id) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND friend_user_id = %d", $friendship_id, bp_loggedin_user_id() ) );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function search_users( $filter, $user_id, $limit = null, $page = null ) {
-                global $wpdb, $bp;
</del><ins>+        public static function search_users( $filter, $user_id, $limit = null, $page = null ) {
+                global $wpdb;
</ins><span class="cx">
</span><span class="cx">                 $filter = like_escape( $wpdb->escape( $filter ) );
</span><span class="cx">
</span><span class="cx">                 $usermeta_table = $wpdb->base_prefix . 'usermeta';
</span><del>-                $users_table = $wpdb->base_prefix . 'users';
</del><ins>+                $users_table = $wpdb->base_prefix . 'users';
</ins><span class="cx">
</span><del>-                if ( $limit && $page )
</del><ins>+                if ( !empty( $limit ) && !empty( $page ) )
</ins><span class="cx">                         $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * intval( $limit ) ), intval( $limit ) );
</span><span class="cx">
</span><span class="cx">                 // filter the user_ids based on the search criteria.
</span><span class="lines">@@ -238,19 +233,19 @@
</span><span class="cx">
</span><span class="cx">                 $filtered_fids = $wpdb->get_col($sql);
</span><span class="cx">
</span><del>-                if ( !$filtered_fids )
</del><ins>+                if ( empty( $filtered_fids ) )
</ins><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 return $filtered_fids;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function search_users_count( $filter ) {
</del><ins>+        public static function search_users_count( $filter ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 $filter = like_escape( $wpdb->escape( $filter ) );
</span><span class="cx">
</span><span class="cx">                 $usermeta_table = $wpdb->prefix . 'usermeta';
</span><del>-                $users_table = $wpdb->base_prefix . 'users';
</del><ins>+                $users_table = $wpdb->base_prefix . 'users';
</ins><span class="cx">
</span><span class="cx">                 // filter the user_ids based on the search criteria.
</span><span class="cx">                 if ( bp_is_active( 'xprofile' ) ) {
</span><span class="lines">@@ -261,13 +256,13 @@
</span><span class="cx">
</span><span class="cx">                 $user_count = $wpdb->get_col($sql);
</span><span class="cx">
</span><del>-                if ( !$user_count )
</del><ins>+                if ( empty( $user_count ) )
</ins><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 return $user_count[0];
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function sort_by_name( $user_ids ) {
</del><ins>+        public static function sort_by_name( $user_ids ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 if ( !bp_is_active( 'xprofile' ) )
</span><span class="lines">@@ -276,11 +271,12 @@
</span><span class="cx">                 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->profile->table_name_data} pd, {$bp->profile->table_name_fields} pf WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} ) ORDER BY pd.value ASC", bp_xprofile_fullname_field_name() ) );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function get_random_friends( $user_id, $total_friends = 5 ) {
</del><ins>+        public static function get_random_friends( $user_id, $total_friends = 5 ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><del>-                $sql = $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE (friend_user_id = %d || initiator_user_id = %d) && is_confirmed = 1 ORDER BY rand() LIMIT %d", $user_id, $user_id, $total_friends );
-                $results = $wpdb->get_results($sql);
</del><ins>+                $fids = array();
+                $sql = $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE (friend_user_id = %d || initiator_user_id = %d) && is_confirmed = 1 ORDER BY rand() LIMIT %d", $user_id, $user_id, $total_friends );
+                $results = $wpdb->get_results( $sql );
</ins><span class="cx">
</span><span class="cx">                 for ( $i = 0, $count = count( $results ); $i < $count; ++$i ) {
</span><span class="cx">                         $fids[] = ( $results[$i]->friend_user_id == $user_id ) ? $results[$i]->initiator_user_id : $results[$i]->friend_user_id;
</span><span class="lines">@@ -288,12 +284,12 @@
</span><span class="cx">
</span><span class="cx">                 // remove duplicates
</span><span class="cx">                 if ( count( $fids ) > 0 )
</span><del>-                        return array_flip(array_flip($fids));
</del><ins>+                        return array_flip( array_flip( $fids ) );
</ins><span class="cx">                 else
</span><span class="cx">                         return false;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function get_invitable_friend_count( $user_id, $group_id ) {
</del><ins>+        public static function get_invitable_friend_count( $user_id, $group_id ) {
</ins><span class="cx">
</span><span class="cx">                 // Setup some data we'll use below
</span><span class="cx">                 $is_group_admin = BP_Groups_Member::check_is_admin( $user_id, $group_id );
</span><span class="lines">@@ -320,13 +316,13 @@
</span><span class="cx">                 return $invitable_count;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function get_user_ids_for_friendship( $friendship_id ) {
</del><ins>+        public static function get_user_ids_for_friendship( $friendship_id ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE id = %d", $friendship_id ) );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function delete_all_for_user( $user_id ) {
</del><ins>+        public static function delete_all_for_user( $user_id ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 // Get friends of $user_id
</span><span class="lines">@@ -344,4 +340,5 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> }
</span><del>-?>
</del><span class="cx">\ No newline at end of file
</span><ins>+
+?>
</ins></span></pre>
</div>
</div>
</body>
</html>