[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-friends/classes/ -> class-bp-friends-friendship.php (summary)

BuddyPress Friends Classes.

File Size: 1026 lines (33 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

BP_Friends_Friendship:: (25 methods):
  __construct()
  populate()
  save()
  delete()
  get_friendships()
  get_friendship_ids_for_user()
  get_friend_user_ids()
  get_friendship_id()
  get_friendship_request_user_ids()
  total_friend_count()
  search_friends()
  check_is_friend()
  update_bp_friends_cache()
  get_bulk_last_active()
  accept()
  withdraw()
  reject()
  search_users()
  search_users_count()
  sort_by_name()
  get_random_friends()
  get_invitable_friend_count()
  get_friendships_by_id()
  get_user_ids_for_friendship()
  delete_all_for_user()


Class: BP_Friends_Friendship  - X-Ref

BuddyPress Friendship object.

__construct( $id = null, $is_request = false, $populate_friend_details = true )   X-Ref
Constructor method.

param: int|null $id                      Optional. The ID of an existing friendship.
param: bool     $is_request              Deprecated.
param: bool     $populate_friend_details True if friend details should be queried.
since: 1.5.0

populate()   X-Ref
Set up data about the current friendship.

since: 1.0.0

save()   X-Ref
Save the current friendship to the database.

return: bool True on success, false on failure.
since: 1.0.0

delete()   X-Ref
Delete the current friendship from the database.

return: bool|int
since: 1.0.0

get_friendships( $user_id, $args = array()   X-Ref
Get the friendships for a given user.

param: int   $user_id              ID of the user whose friends are being retrieved.
param: array $args {
param: string $operator            Optional. Operator to use in `wp_list_filter()`.
return: array $friendships Array of friendship objects.
since: 2.6.0

get_friendship_ids_for_user( $user_id )   X-Ref
Get all friendship IDs for a user.

param: int $user_id ID of the user.
return: array
since: 2.7.0

get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false )   X-Ref
Get the IDs of a given user's friends.

param: int  $user_id              ID of the user whose friends are being retrieved.
param: bool $friend_requests_only Optional. Whether to fetch
param: bool $assoc_arr            Optional. True to receive an array of arrays
return: array $fids IDs of friends for provided user.
since: 1.0.0

get_friendship_id( $user_id, $friend_id )   X-Ref
Get the ID of the friendship object, if any, between a pair of users.

param: int $user_id   The ID of the first user.
param: int $friend_id The ID of the second user.
return: int|null The ID of the friendship object if found, otherwise null.
since: 1.0.0

get_friendship_request_user_ids( $user_id )   X-Ref
Get a list of IDs of users who have requested friendship of a given user.

param: int $user_id The ID of the user who has received the
return: array|bool An array of user IDs, or false if none are found.
since: 1.2.0

total_friend_count( $user_id = 0 )   X-Ref
Get a total friend count for a given user.

param: int $user_id Optional. ID of the user whose friendships you
return: int Friend count for the user.
since: 1.0.0

search_friends( $filter, $user_id, $limit = null, $page = null )   X-Ref
Search the friends of a user by a search string.

param: string   $filter  The search string, matched against xprofile
param: int      $user_id ID of the user whose friends are being searched.
param: int|null $limit   Optional. Max number of friends to return.
param: int|null $page    Optional. The page of results to return. Default:
return: array|bool On success, an array: {
since: 1.0.0

check_is_friend( $initiator_userid, $possible_friend_userid )   X-Ref
Check friendship status between two users.

Note that 'pending' means that $initiator_userid has sent a friend
request to $possible_friend_userid that has not yet been approved,
while 'awaiting_response' is the other way around ($possible_friend_userid
sent the initial request).

param: int $initiator_userid       The ID of the user who is the initiator
param: int $possible_friend_userid The ID of the user who is the
return: string|false $value The friendship status, from among 'not_friends',
since: 1.0.0

update_bp_friends_cache( $user_id, $possible_friend_ids )   X-Ref
Find uncached friendships between a user and one or more other users and cache them.

param: int $user_id                          The ID of the primary user for whom we want
param: int|array|string $possible_friend_ids The IDs of the one or more users
return: null
since: 3.0.0

get_bulk_last_active( $user_ids )   X-Ref
Get the last active date of many users at once.

param: array $user_ids IDs of users whose last_active meta is
return: array $retval Array of last_active values + user_ids.
since: 1.0.0

accept($friendship_id)   X-Ref
Mark a friendship as accepted.

param: int $friendship_id ID of the friendship to be accepted.
return: int Number of database rows updated.
since: 1.0.0

withdraw($friendship_id)   X-Ref
Remove a friendship or a friendship request INITIATED BY the logged-in user.

param: int $friendship_id ID of the friendship to be withdrawn.
return: int Number of database rows deleted.
since: 1.6.0

reject($friendship_id)   X-Ref
Remove a friendship or a friendship request MADE OF the logged-in user.

param: int $friendship_id ID of the friendship to be rejected.
return: int Number of database rows deleted.
since: 1.0.0

search_users( $filter, $user_id, $limit = null, $page = null )   X-Ref
Search users.

param: string   $filter  String to search by.
param: int      $user_id A user ID param that is unused.
param: int|null $limit   Optional. Max number of records to return.
param: int|null $page    Optional. Number of the page to return. Default:
return: array $filtered_ids IDs of users who match the query.
since: 1.0.0

search_users_count( $filter )   X-Ref
Get a count of users who match a search term.

param: string $filter Search term.
return: int Count of users matching the search term.
since: 1.0.0

sort_by_name( $user_ids )   X-Ref
Sort a list of user IDs by their display names.

param: array $user_ids Array of user IDs.
return: array User IDs, sorted by the associated display names.
since: 1.0.0

get_random_friends( $user_id, $total_friends = 5 )   X-Ref
Get a list of random friend IDs.

param: int $user_id       ID of the user whose friends are being retrieved.
param: int $total_friends Optional. Number of random friends to get.
return: array|false An array of random friend user IDs on success;
since: 1.0.0

get_invitable_friend_count( $user_id, $group_id )   X-Ref
Get a count of a user's friends who can be invited to a given group.

Users can invite any of their friends except:

- users who are already in the group
- users who have a pending invite to the group
- users who have been banned from the group

param: int $user_id  ID of the user whose friends are being counted.
param: int $group_id ID of the group friends are being invited to.
return: int $invitable_count Eligible friend count.
since: 1.0.0

get_friendships_by_id( $friendship_ids )   X-Ref
Get friendship objects by ID (or an array of IDs).

param: int|string|array $friendship_ids Single friendship ID or comma-separated/array list of friendship IDs.
return: array
since: 2.7.0

get_user_ids_for_friendship( $friendship_id )   X-Ref
Get the friend user IDs for a given friendship.

param: int $friendship_id ID of the friendship.
return: null|stdClass friend_user_id and initiator_user_id.
since: 1.0.0

delete_all_for_user( $user_id )   X-Ref
Delete all friendships and friend notifications related to a user.

param: int $user_id ID of the user being expunged.
since: 1.0.0



Generated: Thu Jul 18 01:01:42 2019 Cross-referenced by PHPXref 0.7.1