Skip to:
Content

BuddyPress.org

Changeset 548 for trunk/bp-friends.php


Ignore:
Timestamp:
11/17/2008 10:54:11 AM (16 years ago)
Author:
apeatling
Message:

Updated and fixed group invites and group invite email notifications.
Added screen notifications of group invites.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends.php

    r527 r548  
    267267**************************************************************************/
    268268
     269function friends_check_user_has_friends( $user_id = false ) {
     270    if ( !$user_id )
     271        $user_id = $bp['current_userid'];
     272       
     273    $friend_count = get_usermeta( $user_id, 'total_friend_count');
     274       
     275    if ( $friend_count == '' )
     276        return false;
     277   
     278    if ( !(int)$friend_count )
     279        return false;
     280   
     281    return true;
     282}
     283
    269284function friends_get_friendships( $user_id = false, $friendship_ids = false, $pag_num = 5, $pag_page = 1, $get_requests = false, $count = false ) {
    270285    global $bp;
     
    322337    }
    323338
     339function friends_get_friends_invite_list( $user_id = false, $group_id ) {
     340    global $bp;
     341   
     342    if ( !$user_id )
     343        $user_id = $bp['loggedin_userid'];
     344   
     345    $friend_ids = BP_Friends_Friendship::get_friend_ids( $user_id );
     346
     347    for ( $i = 0; $i < count($friend_ids); $i++ ) {
     348        if ( groups_check_user_has_invite( $friend_ids[$i], $group_id ) || groups_is_user_member( $friend_ids[$i], $group_id ) )
     349            continue;
     350           
     351        $display_name = bp_fetch_user_fullname($friend_ids[$i], false);
     352       
     353        if ( $display_name != ' ' ) {
     354            $friends[] = array(
     355                'id' => $friend_ids[$i],
     356                'full_name' => $display_name
     357            );
     358        }
     359    }
     360   
     361    if ( $friends && is_array($friends) )
     362        usort($friends, 'friends_sort_by_name');
     363
     364    if ( !$friends )
     365        return false;
     366
     367    return $friends;
     368   
     369}
     370
     371function friends_count_invitable_friends( $user_id, $group_id ) {
     372    return BP_Friends_Friendship::get_invitable_friend_count( $user_id, $group_id );
     373}
    324374
    325375function friends_get_friend_ids_for_user( $user_id ) {
Note: See TracChangeset for help on using the changeset viewer.