Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/07/2008 07:16:51 AM (18 years ago)
Author:
apeatling
Message:

Bug fixes:

  • Fixed group avatar upload issues
  • Fixed validation on group name/desc/news
  • Fixed support for https://
  • Base support for upcoming home theme and widgets
  • Re-factored JS and CSS inclusion with wp_enqueue_script/styles
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends/bp-friends-classes.php

    r359 r373  
    114114                if ( !$user_id )
    115115                        $user_id = $bp['current_userid'];
    116 
    117                 $sql = $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 );
    118 
    119                 if ( !$friend_count = $wpdb->get_var( $sql ) )
    120                         return 0;
    121                
    122                 if ( !$friend_count )
    123                         return 0;
    124                        
     116                       
     117                if ( !$friend_count = get_usermeta( $user_id, 'total_friend_count') ) {
     118                        update_usermeta( $user_id, 'total_friend_count', 0 );
     119                       
     120                        $sql = $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 );
     121
     122                        if ( !$friend_count = $wpdb->get_var( $sql ) )
     123                                return 0;
     124               
     125                        if ( !$friend_count )
     126                                return 0;
     127                       
     128                        update_usermeta( $user_id, 'total_friend_count', $friend_count );
     129                }
     130               
    125131                return $friend_count;
    126132        }
     
    275281                return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM " . $bp['friends']['table_name'] . " WHERE id = %d", $friendship_id ) );
    276282        }
     283       
     284        function delete_all_for_user( $user_id ) {
     285                global $wpdb, $bp;
     286               
     287                return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['friends']['table_name'] . " WHERE friend_user_id = %d OR initiator_user_id = %d", $user_id, $user_id ) );           
     288        }
    277289}
    278290       
Note: See TracChangeset for help on using the changeset viewer.