[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-groups/classes/ -> class-bp-groups-member.php (summary)

BuddyPress Groups Classes.

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

Defines 1 class

BP_Groups_Member:: (45 methods):
  __construct()
  populate()
  __get()
  __isset()
  get_user_object()
  save()
  promote()
  demote()
  ban()
  unban()
  accept_invite()
  accept_request()
  remove()
  refresh_total_group_count_for_user()
  refresh_total_member_count_for_group()
  delete()
  get_group_ids()
  get_recently_joined()
  get_is_admin_of()
  get_is_mod_of()
  get_is_banned_of()
  total_group_count()
  get_invites()
  get_invite_count_for_user()
  get_user_memberships()
  check_has_invite()
  delete_invite()
  delete_request()
  check_is_admin()
  check_is_mod()
  check_is_member()
  check_is_banned()
  check_is_creator()
  check_for_membership_request()
  get_random_groups()
  get_group_member_ids()
  get_group_administrator_ids()
  prime_group_admins_mods_cache()
  get_group_moderator_ids()
  get_memberships_by_id()
  get_all_membership_request_user_ids()
  get_all_for_group()
  get_membership_ids_for_user()
  delete_all()
  delete_all_for_user()


Class: BP_Groups_Member  - X-Ref

BuddyPress Group Membership object.

__construct( $user_id = 0, $group_id = 0, $id = false, $populate = true )   X-Ref
Constructor method.

param: int      $user_id  Optional. Along with $group_id, can be used to
param: int      $group_id Optional. Along with $user_id, can be used to
param: int|bool $id       Optional. The unique ID of the membership object.
param: bool     $populate Whether to populate the properties of the
since: 1.6.0

populate()   X-Ref
Populate the object's properties.

since: 1.6.0

__get( $key )   X-Ref
Magic getter.

return: BP_Core_User|null
param: string $key Key.
since: 2.8.0

__isset( $key )   X-Ref
Magic issetter.

return: bool
param: string $key Key.
since: 2.8.0

get_user_object()   X-Ref
Get the user object corresponding to this membership.

Used for lazyloading the protected `user` property.

return: BP_Core_User
since: 2.8.0

save()   X-Ref
Save the membership data to the database.

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

promote( $status = 'mod' )   X-Ref
Promote a member to a new status.

return: bool True on success, false on failure.
param: string $status The new status. 'mod' or 'admin'.
since: 1.6.0

demote()   X-Ref
Demote membership to Member status (non-admin, non-mod).

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

ban()   X-Ref
Ban the user from the group.

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

unban()   X-Ref
Unban the user from the group.

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

accept_invite()   X-Ref
Mark a pending invitation as accepted.

since: 1.6.0

accept_request()   X-Ref
Confirm a membership request.

since: 1.6.0

remove()   X-Ref
Remove the current membership.

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

refresh_total_group_count_for_user( $user_id )   X-Ref
Refresh the `total_group_count` for a user.

param: int $user_id ID of the user.
since: 1.8.0

refresh_total_member_count_for_group( $group_id )   X-Ref
Refresh the `total_member_count` for a group.

The request skip the current cache so that we always grab the lastest total count.

param: int $group_id ID of the group.
since: 1.8.0
since: 10.0.0 Updated to use `BP_Groups_Group::get_total_member_count`

delete( $user_id, $group_id )   X-Ref
Delete a membership, based on user + group IDs.

return: bool True on success, false on failure.
param: int $user_id  ID of the user.
param: int $group_id ID of the group.
since: 1.6.0

get_group_ids( $user_id, $limit = false, $page = false )   X-Ref
Get the IDs of the groups of which a specified user is a member.

return: array {
param: int      $user_id ID of the user.
param: int|bool $limit   Optional. Max number of results to return.
param: int|bool $page    Optional. Page offset of results to return.
since: 1.6.0

get_recently_joined( $user_id, $limit = false, $page = false, $filter = false )   X-Ref
Get the IDs of the groups of which a specified user is a member, sorted by the date joined.

return: array {
param: int         $user_id ID of the user.
param: int|bool    $limit   Optional. Max number of results to return.
param: int|bool    $page    Optional. Page offset of results to return.
param: string|bool $filter  Optional. Limit results to groups whose name or
since: 1.6.0

get_is_admin_of( $user_id, $limit = false, $page = false, $filter = false )   X-Ref
Get the IDs of the groups of which a specified user is an admin.

return: array {
param: int         $user_id ID of the user.
param: int|bool    $limit   Optional. Max number of results to return.
param: int|bool    $page    Optional. Page offset of results to return.
param: string|bool $filter  Optional. Limit results to groups whose name or
since: 1.6.0

get_is_mod_of( $user_id, $limit = false, $page = false, $filter = false )   X-Ref
Get the IDs of the groups of which a specified user is a moderator.

return: array {
param: int         $user_id ID of the user.
param: int|bool    $limit   Optional. Max number of results to return.
param: int|bool    $page    Optional. Page offset of results to return.
param: string|bool $filter  Optional. Limit results to groups whose name or
since: 1.6.0

get_is_banned_of( $user_id, $limit = false, $page = false, $filter = false )   X-Ref
Get the groups of which a specified user is banned from.

return: array {
param: int         $user_id ID of the user.
param: int|bool    $limit   Optional. Max number of results to return.
param: int|bool    $page    Optional. Page offset of results to return.
param: string|bool $filter  Optional. Limit results to groups whose name or
since: 2.4.0

total_group_count( $user_id = 0 )   X-Ref
Get the count of groups of which the specified user is a member.

return: int Group count.
param: int $user_id Optional. Default: ID of the displayed user.
since: 1.6.0

get_invites( $user_id, $limit = false, $page = false, $exclude = false )   X-Ref
Get group objects for groups that a user is currently invited to.

return: array {
param: int               $user_id ID of the invitee.
param: int|bool          $limit   Optional. Max number of results to return.
param: int|bool          $page    Optional. Page offset of results to return.
param: string|array|bool $exclude Optional. Array or comma-separated list
since: 1.6.0

get_invite_count_for_user( $user_id = 0 )   X-Ref
Gets the total group invite count for a user.

return: int
param: int $user_id The user ID.
since: 2.0.0

get_user_memberships( $user_id, $args = array()   X-Ref
Gets memberships of a user for purposes of a personal data export.

return: array
param: int $user_id ID of the user.
param: array $args {
since: 4.0.0

check_has_invite( $user_id, $group_id, $type = 'sent' )   X-Ref
Check whether a user has an outstanding invitation to a given group.

return: int|null The ID of the invitation if found; null if not found.
param: int    $user_id  ID of the potential invitee.
param: int    $group_id ID of the group.
param: string $type     If 'sent', results are limited to those invitations
since: 1.6.0

delete_invite( $user_id, $group_id, $inviter_id = false )   X-Ref
Delete an invitation, by specifying user ID and group ID.

return: int Number of records deleted.
param: int $user_id    ID of the user.
param: int $group_id   ID of the group.
param: int $inviter_id ID of the inviter. Specify if you want to delete
since: 1.6.0

delete_request( $user_id, $group_id )   X-Ref
Delete an unconfirmed membership request, by user ID and group ID.

return: int Number of records deleted.
param: int $user_id  ID of the user.
param: int $group_id ID of the group.
since: 1.6.0

check_is_admin( $user_id, $group_id )   X-Ref
Check whether a user is an admin of a given group.

return: mixed
param: int $user_id  ID of the user.
param: int $group_id ID of the group.
since: 1.6.0

check_is_mod( $user_id, $group_id )   X-Ref
Check whether a user is a mod of a given group.

return: mixed
param: int $user_id  ID of the user.
param: int $group_id ID of the group.
since: 1.6.0

check_is_member( $user_id, $group_id )   X-Ref
Check whether a user is a member of a given group.

return: mixed
param: int $user_id  ID of the user.
param: int $group_id ID of the group.
since: 1.6.0

check_is_banned( $user_id, $group_id )   X-Ref
Check whether a user is banned from a given group.

return: int|null int 1 if user is banned; int 0 if user is not banned;
param: int $user_id  ID of the user.
param: int $group_id ID of the group.
since: 1.6.0

check_is_creator( $user_id, $group_id )   X-Ref
Is the specified user the creator of the group?

return: int|null int of group ID if user is the creator; null on failure.
param: int $user_id  ID of the user.
param: int $group_id ID of the group.
since: 1.2.6

check_for_membership_request( $user_id, $group_id )   X-Ref
Check whether a user has an outstanding membership request for a given group.

return: int Database ID of the membership if found; int 0 on failure.
param: int $user_id  ID of the user.
param: int $group_id ID of the group.
since: 1.6.0

get_random_groups( $user_id = 0, $total_groups = 5 )   X-Ref
Get a list of randomly selected IDs of groups that the member belongs to.

return: array Group IDs.
param: int $user_id      ID of the user.
param: int $total_groups Max number of group IDs to return. Default: 5.
since: 1.6.0

get_group_member_ids( $group_id )   X-Ref
Get the IDs of all a given group's members.

return: array IDs of all group members.
param: int $group_id ID of the group.
since: 1.6.0

get_group_administrator_ids( $group_id )   X-Ref
Get a list of all a given group's admins.

return: array Info about group admins (user_id + date_modified).
param: int $group_id ID of the group.
since: 1.6.0

prime_group_admins_mods_cache( $group_ids )   X-Ref
Prime the bp_group_admins cache for one or more groups.

return: bool True on success.
param: array $group_ids IDs of the groups.
since: 2.7.0

get_group_moderator_ids( $group_id )   X-Ref
Get a list of all a given group's moderators.

return: array Info about group mods (user_id + date_modified).
param: int $group_id ID of the group.
since: 1.6.0

get_memberships_by_id( $membership_ids )   X-Ref
Get group membership objects by ID (or an array of IDs).

return: array
param: int|string|array $membership_ids Single membership ID or comma-separated/array list of membership IDs.
since: 2.6.0

get_all_membership_request_user_ids( $group_id )   X-Ref
Get the IDs users with outstanding membership requests to the group.

return: array IDs of users with outstanding membership requests.
param: int $group_id ID of the group.
since: 1.6.0

get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true, $exclude = false )   X-Ref
Get members of a group.

return: false|array
param: int        $group_id            ID of the group being queried for.
param: bool|int   $limit               Max amount to return.
param: bool|int   $page                Pagination value.
param: bool       $exclude_admins_mods Whether or not to exclude admins and moderators.
param: bool       $exclude_banned      Whether or not to exclude banned members.
param: bool|array $exclude             Array of user IDs to exclude.

get_membership_ids_for_user( $user_id )   X-Ref
Get all membership IDs for a user.

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

delete_all( $group_id )   X-Ref
Delete all memberships for a given group.

return: int Number of records deleted.
param: int $group_id ID of the group.
since: 1.6.0

delete_all_for_user( $user_id )   X-Ref
Delete all group membership information for the specified user.

In cases where the user is the sole member of a group, a site administrator is
assigned to be the group's administrator. Unhook `groups_remove_data_for_user()`
to modify this behavior.

return: bool
param: int $user_id ID of the user.
since: 1.0.0
since: 4.0.0 The method behavior was changed so that single-member groups are not deleted.



Generated: Thu Nov 21 01:00:57 2024 Cross-referenced by PHPXref 0.7.1