[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-friends/ -> bp-friends-functions.php (summary)

BuddyPress Friends Functions. Functions are where all the magic happens in BuddyPress. They will handle the actual saving or manipulation of information. Usually they will hand off to a database class for data access, then return true or false on success or failure.

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

Defines 31 functions

  friends_add_friend()
  friends_remove_friend()
  friends_accept_friendship()
  friends_reject_friendship()
  friends_withdraw_friendship()
  friends_check_friendship()
  friends_check_friendship_status()
  friends_get_total_friend_count()
  friends_check_user_has_friends()
  friends_get_friendship_id()
  friends_get_friend_user_ids()
  friends_search_friends()
  friends_get_friendship_request_user_ids()
  friends_get_recently_active()
  friends_get_alphabetically()
  friends_get_newest()
  friends_get_bulk_last_active()
  friends_get_friends_invite_list()
  friends_count_invitable_friends()
  friends_get_friend_count_for_user()
  friends_search_users()
  friends_is_friendship_confirmed()
  friends_update_friend_totals()
  friends_remove_data()
  bp_friends_remove_data_on_delete_user()
  bp_friends_prime_mentions_results()
  friends_notification_new_request()
  friends_notification_accepted_request()
  bp_friends_personal_data_exporter()
  bp_friends_pending_sent_requests_personal_data_exporter()
  bp_friends_pending_received_requests_personal_data_exporter()

Functions
Functions that are not part of a class:

friends_add_friend( $initiator_userid, $friend_userid, $force_accept = false )   X-Ref
Create a new friendship.

param: int  $initiator_userid ID of the "initiator" user (the user who is
param: int  $friend_userid    ID of the "friend" user (the user whose friendship
param: bool $force_accept     Optional. Whether to force acceptance. When false,
since: 1.0.0
return: bool True on success, false on failure.

friends_remove_friend( $initiator_userid, $friend_userid )   X-Ref
Remove a friendship.

Will also delete the related "friendship_accepted" activity item.

param: int $initiator_userid ID of the friendship initiator.
param: int $friend_userid    ID of the friend user.
since: 1.0.0
return: bool True on success, false on failure.

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

Also initiates a "friendship_accepted" activity item.

param: int $friendship_id ID of the pending friendship object.
since: 1.0.0
return: bool True on success, false on failure.

friends_reject_friendship( $friendship_id )   X-Ref
Mark a friendship request as rejected.

param: int $friendship_id ID of the pending friendship object.
since: 1.0.0
return: bool True on success, false on failure.

friends_withdraw_friendship( $initiator_userid, $friend_userid )   X-Ref
Withdraw a friendship request.

param: int $initiator_userid ID of the friendship initiator - this is the
param: int $friend_userid    ID of the requested friend.
since: 1.6.0
return: bool True on success, false on failure.

friends_check_friendship( $user_id, $possible_friend_id )   X-Ref
Check whether two users are friends.

param: int $user_id            ID of the first user.
param: int $possible_friend_id ID of the other user.
since: 1.0.0
return: bool Returns true if the two users are friends, otherwise false.

friends_check_friendship_status( $user_id, $possible_friend_id )   X-Ref
Get the friendship status of two friends.

Will return 'is_friends', 'not_friends', 'pending' or 'awaiting_response'.

param: int $user_id            ID of the first user.
param: int $possible_friend_id ID of the other user.
since: 1.2.0
return: string Friend status of the two users.

friends_get_total_friend_count( $user_id = 0 )   X-Ref
Get the friend count of a given user.

param: int $user_id ID of the user whose friends are being counted.
since: 1.2.0
return: int Friend count of the user.

friends_check_user_has_friends( $user_id )   X-Ref
Check whether a given user has any friends.

param: int $user_id ID of the user whose friends are being checked.
since: 1.0.0
return: bool True if the user has friends, otherwise false.

friends_get_friendship_id( $initiator_user_id, $friend_user_id )   X-Ref
Get the ID of two users' friendship, if it exists.

param: int $initiator_user_id ID of the first user.
param: int $friend_user_id    ID of the second user.
since: 1.2.0
return: int|null ID of the friendship if found, otherwise null.

friends_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 unaccepted
param: bool $assoc_arr            Optional. True to receive an array of arrays keyed as
since: 1.0.0
return: array

friends_search_friends( $search_terms, $user_id, $pag_num = 10, $pag_page = 1 )   X-Ref
Search the friends of a user by a search string.

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

friends_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 friendship requests.
since: 1.2.0
return: array|bool An array of user IDs, or false if none are found.

friends_get_recently_active( $user_id, $per_page = 0, $page = 0, $filter = '' )   X-Ref
Get a user's most recently active friends.

param: int    $user_id  ID of the user whose friends are being retrieved.
param: int    $per_page Optional. Number of results to return per page.
param: int    $page     Optional. Number of the page of results to return.
param: string $filter   Optional. Limit results to those matching a search
since: 1.0.0
return: array See {@link BP_Core_User::get_users()}.

friends_get_alphabetically( $user_id, $per_page = 0, $page = 0, $filter = '' )   X-Ref
Get a user's friends, in alphabetical order.

param: int    $user_id  ID of the user whose friends are being retrieved.
param: int    $per_page Optional. Number of results to return per page.
param: int    $page     Optional. Number of the page of results to return.
param: string $filter   Optional. Limit results to those matching a search
since: 1.0.0
return: array See {@link BP_Core_User::get_users()}.

friends_get_newest( $user_id, $per_page = 0, $page = 0, $filter = '' )   X-Ref
Get a user's friends, in the order in which they joined the site.

param: int    $user_id  ID of the user whose friends are being retrieved.
param: int    $per_page Optional. Number of results to return per page.
param: int    $page     Optional. Number of the page of results to return.
param: string $filter   Optional. Limit results to those matching a search
since: 1.0.0
return: array See {@link BP_Core_User::get_users()}.

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

param: array $friend_ids See BP_Friends_Friendship::get_bulk_last_active().
since: 1.0.0
return: array See BP_Friends_Friendship::get_bulk_last_active().

friends_get_friends_invite_list( $user_id = 0, $group_id = 0 )   X-Ref
Get a list of friends that a user can invite into this group.

Excludes friends that are already in the group, and banned friends if the
user is not a group admin.

param: int $user_id  User ID whose friends to see can be invited. Default:
param: int $group_id Group to check possible invitations against.
since: 1.0.0
return: mixed False if no friends, array of users if friends.

friends_count_invitable_friends( $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.
since: 1.0.0
return: int Eligible friend count.

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

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

friends_search_users( $search_terms, $user_id, $pag_num = 0, $pag_page = 0 )   X-Ref
Return a list of a user's friends, filtered by a search term.

param: string $search_terms Search term to filter on.
param: int    $user_id      ID of the user whose friends are being searched.
param: int    $pag_num      Number of results to return per page. Default: 0 (no
param: int    $pag_page     Number of the page being requested. Default: 0 (no
since: 1.0.0
return: array Array of BP_Core_User objects corresponding to friends.

friends_is_friendship_confirmed( $friendship_id )   X-Ref
Has a friendship been confirmed (accepted)?

param: int $friendship_id The ID of the friendship being checked.
since: 1.0.0
return: bool True if the friendship is confirmed, otherwise false.

friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' )   X-Ref
Update user friend counts.

Friend counts are cached in usermeta for performance reasons. After a
friendship event (acceptance, deletion), call this function to regenerate
the cached values.

param: int    $initiator_user_id ID of the first user.
param: int    $friend_user_id    ID of the second user.
param: string $status            Optional. The friendship event that's been triggered.
since: 1.0.0

friends_remove_data( $user_id )   X-Ref
Remove all friends-related data concerning a given user.

Removes the following:

- Friendships of which the user is a member.
- Cached friend count for the user.
- Notifications of friendship requests sent by the user.

param: int $user_id ID of the user whose friend data is being removed.
since: 1.0.0

bp_friends_remove_data_on_delete_user( $user_id )   X-Ref
Deletes user Friends data on the 'delete_user' hook.

param: int $user_id The ID of the deleted user.
since: 6.0.0

bp_friends_prime_mentions_results()   X-Ref
Used by the Activity component's @mentions to print a JSON list of the current user's friends.

This is intended to speed up @mentions lookups for a majority of use cases.

since: 2.1.0

friends_notification_new_request( $friendship_id, $initiator_id, $friend_id )   X-Ref
Send notifications related to a new friendship request.

When a friendship is requested, an email and a BP notification are sent to
the user of whom friendship has been requested ($friend_id).

param: int $friendship_id ID of the friendship object.
param: int $initiator_id  ID of the user who initiated the request.
param: int $friend_id     ID of the request recipient.
since: 1.0.0

friends_notification_accepted_request( $friendship_id, $initiator_id, $friend_id )   X-Ref
Send notifications related to the acceptance of a friendship request.

When a friendship request is accepted, an email and a BP notification are
sent to the user who requested the friendship ($initiator_id).

param: int $friendship_id ID of the friendship object.
param: int $initiator_id  ID of the user who initiated the request.
param: int $friend_id     ID of the request recipient.
since: 1.0.0

bp_friends_personal_data_exporter( $email_address, $page )   X-Ref
Finds and exports friendship data associated with an email address.

param: string $email_address  The user's email address.
param: int    $page           Batch number.
since: 4.0.0
return: array An array of personal data.

bp_friends_pending_sent_requests_personal_data_exporter( $email_address, $page )   X-Ref
Finds and exports pending sent friendship request data associated with an email address.

param: string $email_address  The user's email address.
param: int    $page           Batch number.
since: 4.0.0
return: array An array of personal data.

bp_friends_pending_received_requests_personal_data_exporter( $email_address, $page )   X-Ref
Finds and exports pending received friendship request data associated with an email address.

param: string $email_address  The user's email address.
param: int    $page           Batch number.
since: 4.0.0
return: array An array of personal data.



Generated: Sat Apr 27 01:00:55 2024 Cross-referenced by PHPXref 0.7.1