[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

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

BuddyPress Groups Classes.

File Size: 1790 lines (53 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.

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

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

since: 1.6.0

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

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

delete()   X-Ref
Delete the current group.

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

__get( $key )   X-Ref
Magic getter.

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

__isset( $key )   X-Ref
Magic issetter.

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

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

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

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

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

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.

return: array|null
since: 2.7.0

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.

return: array|null
since: 2.7.0

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.

return: bool|int
since: 2.7.0

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

return: bool
since: 2.7.0

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

return: bool
since: 2.9.0

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

return: int|null Group ID if found; null if not.
param: string      $slug       Slug to check.
param: string|bool $table_name Deprecated.
since: 1.6.0

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()}.

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

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

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

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.

return: array    IDs of users who have been invited to the group by the user but have not
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
since: 1.6.0
since: 2.9.0 Added $sent as a parameter.

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.

return: false|array {
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.
since: 1.6.0

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

return: array {
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).
since: 1.6.0

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

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

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

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

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

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

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

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

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

return: array {
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:
since: 1.6.0

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

return: array {
param: array $args {
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.

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

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

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

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

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

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

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

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.

return: false|array {
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
since: 1.6.0

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.

return: array {
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 Optional. Whether to fetch extra
param: string|array|bool $exclude         Optional. Array or comma-separated list of group
since: 1.6.0

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)

return: array $paged_groups
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.
since: 1.6.0

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

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

get_total_group_count()   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' ).

return: int Group count.
since: 1.6.0

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

return: int Count of confirmed members for the group.
param: int $group_id Group ID.
since: 1.6.0

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().

return: array
since: 1.7.0

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

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

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.

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



Generated: Wed Jul 17 01:01:40 2019 Cross-referenced by PHPXref 0.7.1