{"id":4333,"date":"2022-06-29T12:26:37","date_gmt":"2022-06-29T11:26:37","guid":{"rendered":"https:\/\/ibex.tech\/wordpress-sites\/?p=4333"},"modified":"2022-07-07T10:43:28","modified_gmt":"2022-07-07T09:43:28","slug":"buddypress-groups-functions","status":"publish","type":"post","link":"https:\/\/ibex.tech\/wordpress-sites\/plugins\/buddypress\/groups\/buddypress-groups-functions","title":{"rendered":".Buddypress Groups Functions"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Resources<\/h4>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/buddypress\/buddypress\/blob\/master\/src\/bp-groups\/bp-groups-functions.php\" target=\"_blank\">https:\/\/github.com\/buddypress\/buddypress\/blob\/master\/src\/bp-groups\/bp-groups-functions.php<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Functions<\/h4>\n\n\n\n<p>Fetch a single group object<br>function groups_get_group( $group_id )<\/p>\n\n\n\n<p>Retrieve group by a given field.<br>function bp_get_group_by( $field, $value )<\/p>\n\n\n\n<p>Retrieve a Group.<br>function bp_get_group( $group = false )<\/p>\n\n\n\n<p>Group Creation, Editing &amp; Deletion<\/p>\n\n\n\n<p>Create a group<br>function groups_create_group( $args = &#8221; )<\/p>\n\n\n\n<p>Edit the base details for a group<br>function groups_edit_base_group_details( $args = array() )<\/p>\n\n\n\n<p>Edit the base details for a group<br>function groups_edit_group_settings( $group_id, $enable_forum, $status, $invite_status = false, $parent_id = false )<\/p>\n\n\n\n<p>Delete a group and all of its associated metadata.<br>function groups_delete_group( $group_id )<\/p>\n\n\n\n<p>Check a group status (eg &#8216;private&#8217;) against the list of registered statuses<br>function groups_is_valid_status( $status )<\/p>\n\n\n\n<p>Provide a unique, sanitized version of a group slug.<br>function groups_check_slug( $slug )<\/p>\n\n\n\n<p>Get slug from a group.<br>function groups_get_slug( $group )<\/p>\n\n\n\n<p>Get a group ID by its slug.<br>function groups_get_id( $group_slug )<\/p>\n\n\n\n<p>Get a group ID by checking against old (not currently active) slugs<br>function groups_get_id_by_previous_slug( $group_slug )<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">User Actions<\/h5>\n\n\n\n<p>Remove a user from a group<br>function groups_leave_group( $group, $user_id = 0 )<\/p>\n\n\n\n<p>Add a user to a group.<br>function groups_join_group( $group, $user_id = 0 )<\/p>\n\n\n\n<p>Update the last_activity meta value for a given group<br>function groups_update_last_activity( $group = 0 )<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">General Group Functions<\/h5>\n\n\n\n<p>Get a list of group administrators<br>function groups_get_group_admins( $group_id )<\/p>\n\n\n\n<p>Get a list of group moderators<br>function groups_get_group_mods( $group_id )<\/p>\n\n\n\n<p>Fetch the members of a group<br>function groups_get_group_members( $args = array() )<\/p>\n\n\n\n<p>Get the member count for a group<br>function groups_get_total_member_count( $group, $skip_cache = false )<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Group Fetching, Filtering &amp; Searching<\/h5>\n\n\n\n<p>Get a collection of groups, based on the parameters passed<br>function groups_get_groups( $args = &#8221; )<\/p>\n\n\n\n<p>Get the total group count for the site<br>function groups_get_total_group_count( $skip_cache = false )<\/p>\n\n\n\n<p>Get the IDs of the groups of which a specified user is a member<br>function groups_get_user_groups( $user_id = 0, $pag_num = 0, $pag_page = 0 )<\/p>\n\n\n\n<p>Get a list of groups of which the specified user is a member<br>function bp_get_user_groups( $user_id, $args = array() )<\/p>\n\n\n\n<p>Get the count of groups of which the specified user is a member<br>function groups_total_groups_for_user( $user_id = 0 )<\/p>\n\n\n\n<p>Get the BP_Groups_Group object corresponding to the current group<br>function groups_get_current_group()<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Group Avatars<\/h5>\n\n\n\n<p>Generate the avatar upload directory path for a given group<br>function groups_avatar_upload_dir( $group_id = 0 )<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Group Member Status Checks<\/h5>\n\n\n\n<p>Get the Group roles<br>function bp_groups_get_group_roles()<\/p>\n\n\n\n<p>Check whether a user is an admin of a given group<br>function groups_is_user_admin( $user_id, $group_id )<\/p>\n\n\n\n<p>Check whether a user is a mod of a given group<br>function groups_is_user_mod( $user_id, $group_id )<\/p>\n\n\n\n<p>Check whether a user is a member of a given group<br>function groups_is_user_member( $user_id, $group_id )<\/p>\n\n\n\n<p>Check whether a user is banned from a given group<br>function groups_is_user_banned( $user_id, $group_id )<\/p>\n\n\n\n<p>Check whether a user has an outstanding invitation to a group<br>function groups_is_user_invited( $user_id, $group_id, $type = &#8216;sent&#8217; )<\/p>\n\n\n\n<p>Check whether a user has a pending membership request for a group<br>function groups_is_user_pending( $user_id, $group_id )<\/p>\n\n\n\n<p>Is the specified user the creator of the group?<br>function groups_is_user_creator( $user_id, $group_id )<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Group Invitations<\/h5>\n\n\n\n<p>Get group objects for groups that a user is currently invited to<br>function groups_get_invites_for_user( $user_id = 0, $limit = false, $page = false, $exclude = false )<\/p>\n\n\n\n<p>Get the total group invite count for a user<br>function groups_get_invite_count_for_user( $user_id = 0 )<\/p>\n\n\n\n<p>Get an array of group IDs to which a user is invited<br>function groups_get_invited_to_group_ids( $user_id = 0 )<\/p>\n\n\n\n<p>Invite a user to a group<br>function groups_invite_user( $args = &#8221; )<\/p>\n\n\n\n<p>Uninvite a user from a group<br>function groups_uninvite_user( $user_id, $group_id, $inviter_id = false )<\/p>\n\n\n\n<p>Process the acceptance of a group invitation<br>function groups_accept_invite( $user_id, $group_id )<\/p>\n\n\n\n<p>Reject a group invitation.<br>function groups_reject_invite( $user_id, $group_id, $inviter_id = false )<\/p>\n\n\n\n<p>Delete a group invitation<br>function groups_delete_invite( $user_id, $group_id, $inviter_id = false )<\/p>\n\n\n\n<p>Send some or all pending invites by a single user to a specific group<br>function groups_send_invites( \u2026$args )<\/p>\n\n\n\n<p>Get IDs of users with outstanding invites to a given group<br>function groups_get_invites_for_group( $user_id, $group_id, $sent = null )<\/p>\n\n\n\n<p>Get invitations to a given group filtered by arguments<br>function groups_get_invites( $args = array() )<\/p>\n\n\n\n<p>Check to see whether a user has already been invited to a group<br>function groups_check_user_has_invite( $user_id, $group_id, $type = &#8216;sent&#8217; )<\/p>\n\n\n\n<p>Check to see whether a user has already been invited to a group by a particular user<br>function groups_check_has_invite_from_user( $user_id, $group_id, $inviter_id = false, $type = &#8216;sent&#8217; )<\/p>\n\n\n\n<p>Delete all invitations to a given group<br>function groups_delete_all_group_invites( $group_id )<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Group Promotion &amp; Banning<\/h5>\n\n\n\n<p>Promote a member to a new status within a group<br>function groups_promote_member( $user_id, $group_id, $status )<\/p>\n\n\n\n<p>Demote a user to &#8216;member&#8217; status within a group<br>function groups_demote_member( $user_id, $group_id )<\/p>\n\n\n\n<p>Ban a member from a group<br>function groups_ban_member( $user_id, $group_id )<\/p>\n\n\n\n<p>Unban a member from a group.<br>function groups_unban_member( $user_id, $group_id )<\/p>\n\n\n\n<p>Group Removal<br>function groups_remove_member( $user_id, $group_id )<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Group Membership<\/h5>\n\n\n\n<p>Create a group membership request<br>function groups_send_membership_request( \u2026$args )<\/p>\n\n\n\n<p>Accept a pending group membership request<br>function groups_accept_membership_request( $membership_id, $user_id = 0, $group_id = 0 )<\/p>\n\n\n\n<p>Reject a pending group membership request<br>function groups_reject_membership_request( $membership_id, $user_id = 0, $group_id = 0 )<\/p>\n\n\n\n<p>Delete a pending group membership request<br>function groups_delete_membership_request( $membership_id, $user_id = 0, $group_id = 0 )<\/p>\n\n\n\n<p>Get group membership requests filtered by arguments<br>function groups_get_requests( $args = array() )<\/p>\n\n\n\n<p>Check whether a user has an outstanding membership request for a given group<br>function groups_check_for_membership_request( $user_id, $group_id )<\/p>\n\n\n\n<p>Get an array of group IDs to which a user has requested membership<br>function groups_get_membership_requested_group_ids( $user_id = 0 )<\/p>\n\n\n\n<p>Get an array of group IDs to which a user has requested membership<br>function groups_get_membership_requested_user_ids( $group_id = 0 )<\/p>\n\n\n\n<p>Accept all pending membership requests to a group<br>function groups_accept_all_pending_membership_requests( $group_id = 0 )<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Group Meta<\/h5>\n\n\n\n<p>Delete metadata for a group<br>function groups_delete_groupmeta( $group_id, $meta_key = false, $meta_value = false, $delete_all = false )<\/p>\n\n\n\n<p>Get a piece of group metadata<br>function groups_get_groupmeta( $group_id, $meta_key = &#8221;, $single = true )<\/p>\n\n\n\n<p>Update a piece of group metadata<br>function groups_update_groupmeta( $group_id, $meta_key, $meta_value, $prev_value = &#8221; )<\/p>\n\n\n\n<p>Add a piece of group metadata<br>function groups_add_groupmeta( $group_id, $meta_key, $meta_value, $unique = false )<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Group Cleanup Functions<\/h5>\n\n\n\n<p>Delete all group membership information for the specified user<br>function groups_remove_data_for_user( $user_id )<\/p>\n\n\n\n<p>Deletes user group data on the &#8216;delete_user&#8217; hook<br>function bp_groups_remove_data_for_user_on_delete_user( $user_id )<\/p>\n\n\n\n<p>Update orphaned child groups when the parent is deleted<br>function bp_groups_update_orphaned_groups_on_group_delete( $group )<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Group Types<\/h5>\n\n\n\n<p>Output the slug of the Group type taxonomy<br>function bp_group_type_tax_name()<\/p>\n\n\n\n<p>Returns labels used by the Group type taxonomy<br>function bp_get_group_type_tax_labels()<\/p>\n\n\n\n<p>Returns arguments used by the Group type taxonomy<br>function bp_get_group_type_tax_args()<\/p>\n\n\n\n<p>Register the Group Types taxonomy<br>function bp_groups_register_group_type_taxonomy( $taxonomies = array() )<\/p>\n\n\n\n<p>Fire the &#8216;bp_groups_register_group_types&#8217; action<br>function bp_groups_register_group_types()<\/p>\n\n\n\n<p>Extend generic Type metadata schema to match Group Type needs<br>function bp_get_group_type_metadata_schema( $schema = array(), $taxonomy = &#8221; )<\/p>\n\n\n\n<p>Registers the Group type metadata<br>function bp_register_group_type_metadata()<\/p>\n\n\n\n<p>Register a group type<br>function bp_groups_register_group_type( $group_type, $args = array() )<\/p>\n\n\n\n<p>Get a list of all registered group type objects<br>function bp_groups_get_group_types( $args = array(), $output = &#8216;names&#8217;, $operator = &#8216;and&#8217; )<\/p>\n\n\n\n<p>Retrieve a group type object by name<br>function bp_groups_get_group_type_object( $group_type )<\/p>\n\n\n\n<p>Only gets the group types registered by code<br>function bp_get_group_types_registered_by_code()<\/p>\n\n\n\n<p>Generates missing metadata for a type registered by code<br>function bp_set_registered_by_code_group_type_metadata( $metadata = array(), $type = &#8221; )<\/p>\n\n\n\n<p>Insert group types registered by code not yet saved into the database as WP Terms<br>function bp_insert_group_types_registered_by_code()<\/p>\n\n\n\n<p>Set type for a group<br>function bp_groups_set_group_type( $group_id, $group_type, $append = false )<\/p>\n\n\n\n<p>Get type for a group<br>function bp_groups_get_group_type( $group_id, $single = true, $use_db = true )<\/p>\n\n\n\n<p>Remove type for a group<br>function bp_groups_remove_group_type( $group_id, $group_type )<\/p>\n\n\n\n<p>Check whether the given group has a certain group type<br>function bp_groups_has_group_type( $group_id, $group_type )<\/p>\n\n\n\n<p>Get the &#8220;current&#8221; group type, if one is provided, in group directories<br>function bp_get_current_group_directory_type()<\/p>\n\n\n\n<p>Delete a group&#8217;s type when the group is deleted<br>function bp_remove_group_type_on_group_delete( $group_id = 0 )<\/p>\n\n\n\n<p>Finds and exports group membership data associated with an email address<br>function bp_groups_memberships_personal_data_exporter( $email_address, $page )<\/p>\n\n\n\n<p>Finds and exports data on pending group membership requests associated with an email address<br>function bp_groups_pending_requests_personal_data_exporter( $email_address, $page )<\/p>\n\n\n\n<p>Finds and exports data on pending group invitations sent by a user associated with an email address<br>function bp_groups_pending_sent_invitations_personal_data_exporter( $email_address, $page )<\/p>\n\n\n\n<p>Finds and exports data on pending group invitations received by a user associated with an email address<br>function bp_groups_pending_received_invitations_personal_data_exporter( $email_address, $page )<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Resources https:\/\/github.com\/buddypress\/buddypress\/blob\/master\/src\/bp-groups\/bp-groups-functions.php Functions Fetch a single group objectfunction groups_get_group( $group_id ) Retrieve group by a given field.function bp_get_group_by( $field, $value ) Retrieve a Group.function bp_get_group( $group = false ) Group Creation, Editing &amp; Deletion Create a groupfunction groups_create_group( $args = &#8221; ) Edit the base details for a groupfunction groups_edit_base_group_details( $args = array() ) Edit [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[360],"tags":[],"class_list":["post-4333","post","type-post","status-publish","format-standard","hentry","category-groups"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/wordpress-sites\/wp-json\/wp\/v2\/posts\/4333","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/wordpress-sites\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/wordpress-sites\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/wordpress-sites\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/wordpress-sites\/wp-json\/wp\/v2\/comments?post=4333"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/wordpress-sites\/wp-json\/wp\/v2\/posts\/4333\/revisions"}],"predecessor-version":[{"id":4363,"href":"https:\/\/ibex.tech\/wordpress-sites\/wp-json\/wp\/v2\/posts\/4333\/revisions\/4363"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/wordpress-sites\/wp-json\/wp\/v2\/media?parent=4333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/wordpress-sites\/wp-json\/wp\/v2\/categories?post=4333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/wordpress-sites\/wp-json\/wp\/v2\/tags?post=4333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}