[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

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

BuddyPress Groups Classes.

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

Defines 1 class

BP_Groups_Group:: (37 methods):
  __construct()
  populate()
  save()
  delete()
  __get()
  __isset()
  __set()
  get_admins()
  get_mods()
  set_up_admins_and_mods()
  get_is_member()
  get_user_has_access()
  is_visible()
  group_exists()
  get_id_from_slug()
  get_id_by_previous_slug()
  get_invites()
  filter_user_groups()
  search_groups()
  check_slug()
  get_slug()
  has_members()
  has_membership_requests()
  get_membership_requests()
  get()
  get_meta_query_sql()
  convert_type_to_order_orderby()
  convert_orderby_to_order_by_term()
  get_by_letter()
  get_random()
  get_group_extras()
  delete_all_invites()
  get_total_group_count()
  get_total_member_count()
  get_group_type_ids()
  get_sql_clause_for_group_types()
  strip_leading_and()


Class: BP_Groups_Group  - X-Ref

BuddyPress Group object.

__construct( $id = null, $args = array()   X-Ref
Constructor method.

since: 1.6.0
param: int|null $id   Optional. If the ID of an existing group is provided,
param: array    $args {

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

since: 1.6.0

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

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

delete()   X-Ref
Delete the current group.

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

__get( $key )   X-Ref
Magic getter.

since: 2.7.0
param: string $key Property name.
return: mixed

__isset( $key )   X-Ref
Magic issetter.

Used to maintain backward compatibility for properties that are now
accessible only via magic method.

since: 2.7.0
param: string $key Property name.
return: bool

__set( $key, $value )   X-Ref
Magic setter.

Used to maintain backward compatibility for properties that are now
accessible only via magic method.

since: 2.7.0
param: string $key   Property name.
param: mixed  $value Property value.
return: bool

get_admins()   X-Ref
Get a list of the group's admins.

Used to provide cache-friendly access to the 'admins' property of
the group object.

since: 2.7.0
return: array|null

get_mods()   X-Ref
Get a list of the group's mods.

Used to provide cache-friendly access to the 'mods' property of
the group object.

since: 2.7.0
return: array|null

set_up_admins_and_mods()   X-Ref
Set up admins and mods for the current group object.

Called only when the 'admins' or 'mods' property is accessed.

since: 2.7.0

get_is_member()   X-Ref
Checks whether the logged-in user is a member of the group.

since: 2.7.0
return: bool|int

get_user_has_access()   X-Ref
Checks whether the logged-in user has access to the group.

since: 2.7.0
return: bool

is_visible()   X-Ref
Checks whether the current user can know the group exists.

since: 2.9.0
return: bool

group_exists( $slug, $table_name = false )   X-Ref
Get whether a group exists for a given slug.

since: 1.6.0
since: 10.0.0 Updated to add the deprecated notice.
param: string      $slug       Slug to check.
param: string|bool $table_name Deprecated.
return: int|null|bool False if empty slug, group ID if found; `null` if not.

get_id_from_slug( $slug )   X-Ref
Get the ID of a group by the group's slug.

Alias of {@link BP_Groups_Group::group_exists()}.

since: 1.6.0
param: string $slug See {@link BP_Groups_Group::group_exists()}.
return: int|null|bool See {@link BP_Groups_Group::group_exists()}.

get_id_by_previous_slug( $slug )   X-Ref
Get whether a group exists for an old slug.

since: 2.9.0
param: string      $slug       Slug to check.
return: int|null|false Group ID if found; null if not; false if missing parameters.

get_invites( $user_id, $group_id, $sent = null )   X-Ref
Get IDs of users with outstanding invites to a given group from a specified user.

since: 1.6.0
since: 2.9.0 Added $sent as a parameter.
param: int      $user_id  ID of the inviting user.
param: int      $group_id ID of the group.
param: int|null $sent     Query for a specific invite sent status. If 0, this will query for users
return: array    IDs of users who have been invited to the group by the user but have not

filter_user_groups( $filter, $user_id = 0, $order = false, $limit = null, $page = null )   X-Ref
Get a list of a user's groups, filtered by a search string.

since: 1.6.0
param: string   $filter  Search term. Matches against 'name' and
param: int      $user_id ID of the user whose groups are being searched.
param: mixed    $order   Not used.
param: int|null $limit   Optional. The max number of results to return.
param: int|null $page    Optional. The page offset of results to return.
return: false|array {

search_groups( $filter, $limit = null, $page = null, $sort_by = false, $order = false )   X-Ref
Get a list of groups, filtered by a search string.

since: 1.6.0
param: string      $filter  Search term. Matches against 'name' and
param: int|null    $limit   Optional. The max number of results to return.
param: int|null    $page    Optional. The page offset of results to return.
param: string|bool $sort_by Column to sort by. Default: false (default
param: string|bool $order   ASC or DESC. Default: false (default sort).
return: array {

check_slug( $slug )   X-Ref
Check for the existence of a slug.

since: 1.6.0
param: string $slug Slug to check.
return: string|null The slug, if found. Otherwise null.

get_slug( $group_id )   X-Ref
Get the slug for a given group ID.

since: 1.6.0
param: int $group_id ID of the group.
return: string|null The slug, if found. Otherwise null.

has_members( $group_id )   X-Ref
Check whether a given group has any members.

since: 1.6.0
param: int $group_id ID of the group.
return: bool True if the group has members, otherwise false.

has_membership_requests( $group_id )   X-Ref
Check whether a group has outstanding membership requests.

since: 1.6.0
param: int $group_id ID of the group.
return: int|null The number of outstanding requests, or null if

get_membership_requests( $group_id, $limit = null, $page = null )   X-Ref
Get outstanding membership requests for a group.

since: 1.6.0
param: int      $group_id ID of the group.
param: int|null $limit    Optional. Max number of results to return.
param: int|null $page     Optional. Page offset of results returned. Default:
return: array {

get( $args = array()   X-Ref
Query for groups.

since: 1.6.0
since: 2.6.0 Added `$group_type`, `$group_type__in`, and `$group_type__not_in` parameters.
since: 2.7.0 Added `$update_admin_cache` and `$parent_id` parameters.
since: 2.8.0 Changed `$search_terms` parameter handling and added `$search_columns` parameter.
since: 2.9.0 Added `$slug` parameter.
since: 10.0.0 Added `$date_query` parameter.
param: array $args {
return: array {

get_meta_query_sql( $meta_query = array()   X-Ref
Get the SQL for the 'meta_query' param in BP_Groups_Group::get()

We use WP_Meta_Query to do the heavy lifting of parsing the
meta_query array and creating the necessary SQL clauses.

since: 1.8.0
param: array $meta_query An array of meta_query filters. See the
return: array $sql_array 'join' and 'where' clauses.

convert_type_to_order_orderby( $type = '' )   X-Ref
Convert the 'type' parameter to 'order' and 'orderby'.

since: 1.8.0
param: string $type The 'type' shorthand param.
return: array {

convert_orderby_to_order_by_term( $orderby )   X-Ref
Convert the 'orderby' param into a proper SQL term/column.

since: 1.8.0
param: string $orderby Orderby term as passed to get().
return: string $order_by_term SQL-friendly orderby term.

get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false )   X-Ref
Get a list of groups whose names start with a given letter.

since: 1.6.0
param: string            $letter          The letter.
param: int|null          $limit           Optional. The max number of results to return.
param: int|null          $page            Optional. The page offset of results to return.
param: bool              $populate_extras Deprecated.
param: string|array|bool $exclude         Optional. Array or comma-separated list of group
return: false|array {

get_random( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false )   X-Ref
Get a list of random groups.

Use BP_Groups_Group::get() with 'type' = 'random' instead.

since: 1.6.0
since: 10.0.0 Deprecate the `$populate_extras` arg.
param: int|null          $limit           Optional. The max number of results to return.
param: int|null          $page            Optional. The page offset of results to return.
param: int               $user_id         Optional. If present, groups will be limited to
param: string|bool       $search_terms    Optional. Limit groups to those whose name
param: bool              $populate_extras Deprecated.
param: string|array|bool $exclude         Optional. Array or comma-separated list of group
return: array {

get_group_extras( &$paged_groups, &$group_ids, $type = false )   X-Ref
Fetch extra data for a list of groups.

This method is used throughout the class, by methods that take a
$populate_extras parameter.

Data fetched:
- Logged-in user's status within each group (is_member,
is_confirmed, is_pending, is_banned)

since: 1.6.0
param: array        $paged_groups Array of groups.
param: string|array $group_ids    Array or comma-separated list of IDs matching
param: string|bool  $type         Not used.
return: array $paged_groups

delete_all_invites( $group_id )   X-Ref
Delete all invitations to a given group.

since: 1.6.0
param: int $group_id ID of the group whose invitations are being deleted.
return: int|null Number of rows records deleted on success, null on

get_total_group_count( $skip_cache = false )   X-Ref
Get a total group count for the site.

Will include hidden groups in the count only if
bp_current_user_can( 'bp_moderate' ).

since: 1.6.0
since: 10.0.0 Added the `$skip_cache` parameter.
param: bool $skip_cache Optional. Skip getting count from cache.
return: int

get_total_member_count( $group_id, $skip_cache = false )   X-Ref
Get the member count for a group.

since: 1.6.0
since: 10.0.0 Updated to use the `groups_get_group_members`.
param: int  $group_id   Group ID.
param: bool $skip_cache Optional. Skip getting count from cache. Defaults to false.
return: int Count of confirmed members for the group.

get_group_type_ids()   X-Ref
Get an array containing ids for each group type.

A bit of a kludge workaround for some issues
with bp_has_groups().

since: 1.7.0
return: array

get_sql_clause_for_group_types( $group_types, $operator )   X-Ref
Get SQL clause for group type(s).

since: 2.6.0
param: string|array $group_types Group type(s).
param: string       $operator    'IN' or 'NOT IN'.
return: string       $clause      SQL clause.

strip_leading_and( $s )   X-Ref
Strips the leading AND and any surrounding whitespace from a string.

Used here to normalize SQL fragments generated by `WP_Meta_Query` and
other utility classes.

since: 2.7.0
param: string $s String.
return: string



Generated: Tue Dec 3 01:00:55 2024 Cross-referenced by PHPXref 0.7.1