Contents
groups_is_user_member( int $user_id, int $group_id )
Check whether a user is a member of a given group.
Description
Parameters
- $user_id
-
(Required) ID of the user.
- $group_id
-
(Required) ID of the group.
Return
(int|bool) ID of the membership if the user is member, otherwise false.
Source
File: bp-groups/bp-groups-functions.php
function groups_is_user_member( $user_id, $group_id ) { $is_member = false; $user_groups = bp_get_user_groups( $user_id, array( 'is_admin' => null, 'is_mod' => null, ) ); if ( isset( $user_groups[ $group_id ] ) ) { $is_member = $user_groups[ $group_id ]->id; } return $is_member; }
Changelog
Version | Description |
---|---|
BuddyPress 1.0.0 | Introduced. |
Related
Uses
Uses | Description |
---|---|
bp-groups/bp-groups-functions.php: bp_get_user_groups() |
Get a list of groups of which the specified user is a member. |
Used By | Description |
---|---|
bp-media/classes/class-bp-rest-media-endpoint.php: BP_REST_Media_Endpoint::bp_rest_check_privacy_restriction() |
Check user access based on the privacy for the single Media. |
bp-media/classes/class-bp-rest-media-albums-endpoint.php: BP_REST_Media_Albums_Endpoint::bp_rest_check_album_privacy_restriction() |
Check user access based on the privacy for the single album. |
bp-document/classes/class-bp-rest-document-folder-endpoint.php: BP_REST_Document_Folder_Endpoint::bp_rest_check_folder_privacy_restriction() |
Check user access based on the privacy for the single folder. |
bp-document/classes/class-bp-rest-document-endpoint.php: BP_REST_Document_Endpoint::bp_rest_check_privacy_restriction() |
Check user access based on the privacy for the single document. |
bp-document/classes/class-bp-document-privacy.php: BP_Document_Privacy::is_document_visible() |
Check if document is visible or not to the logged in user |
bp-templates/bp-nouveau/includes/document/ajax.php: bp_nouveau_ajax_document_get_activity() |
Get activity for the document. |
bp-notifications/classes/class-bp-rest-notifications-endpoint.php: BP_REST_Notifications_Endpoint::bp_rest_get_notification_actions() |
Action to perform. |
bp-notifications/classes/class-bp-rest-notifications-endpoint.php: BP_REST_Notifications_Endpoint::bp_rest_link_url_update() |
Update Link URL after request accept/reject. |
bp-groups/bp-groups-functions.php: groups_can_user_manage_document() |
Check whether a user is allowed to manage document in a given group. |
bp-groups/bp-groups-functions.php: groups_can_user_manage_messages() |
Check whether a user is allowed to manage messages in a given group. |
bp-groups/bp-groups-functions.php: groups_can_user_manage_folders() |
Check whether a user is allowed to manage albums in a given group. |
bp-groups/classes/class-bp-rest-groups-endpoint.php: BP_REST_Groups_Endpoint::prepare_item_for_response() |
Prepares group data for return as an object. |
bp-groups/classes/class-bp-rest-groups-endpoint.php: BP_REST_Groups_Endpoint::can_see() |
Can a user see a group? |
bp-groups/classes/class-bp-rest-groups-endpoint.php: BP_REST_Groups_Endpoint::bp_rest_user_can_join() |
Check the group join with members type. |
bp-groups/classes/class-bp-rest-groups-endpoint.php: BP_REST_Groups_Endpoint::bp_get_group_member_section_title() |
Return the group member section header while in the groups members loop. |
bp-groups/classes/class-bp-rest-groups-details-endpoint.php: BP_REST_Groups_Details_Endpoint::get_item() |
Retrieve groups detail. |
bp-groups/classes/class-bp-rest-group-membership-endpoint.php: BP_REST_Group_Membership_Endpoint::create_item_permissions_check() |
Checks if a given request has access to join a group. |
bp-groups/classes/class-bp-rest-group-membership-endpoint.php: BP_REST_Group_Membership_Endpoint::prepare_item_for_response() |
Prepares group member data for return as an object. |
bp-groups/classes/class-bp-groups-invitation-manager.php: BP_Groups_Invitation_Manager::run_acceptance_action() |
This is where custom actions are added to run when an invitation or request is accepted. |
bp-forums/classes/class-bp-rest-topics-endpoint.php: BP_REST_Topics_Endpoint::create_item() |
Create a topic. |
bp-forums/classes/class-bp-rest-topics-endpoint.php: BP_REST_Topics_Endpoint::update_item() |
Update/Edit a topic. |
bp-forums/classes/class-bp-rest-forums-endpoint.php: BP_REST_Forums_Endpoint::can_access_content() |
Check current access permission. |
bp-forums/classes/class-bp-rest-reply-endpoint.php: BP_REST_Reply_Endpoint::create_item() |
Create a reply. |
bp-forums/classes/class-bp-rest-reply-endpoint.php: BP_REST_Reply_Endpoint::update_item() |
Update/Edit a reply. |
bp-activity/classes/class-bp-rest-activity-endpoint.php: BP_REST_Activity_Endpoint::show_hidden() |
Show hidden activity? |
bp-forums/users/template.php: bbp_user_can_view_forum() |
Check if the user can access a specific forum |
bp-forums/forums/functions.php: bbp_exclude_forum_ids() |
Returns a meta_query that either includes or excludes hidden forum IDs from a query. |
bp-forums/functions.php: bbp_group_is_member() |
Is the current user a member of the current group |
bp-forums/replies/functions.php: bbp_adjust_forum_role_labels() |
Change forum role labels to conform to BuddyBoss Platform naming conventions |
bp-media/classes/class-bp-media-privacy.php: BP_Media_Privacy::is_media_visible() |
Check if media is visible or not to the logged in user |
bp-groups/screens/single/admin/membership-requests.php: groups_screen_group_admin_requests() |
Handle the display of Admin > Membership Requests. |
bp-groups/actions/join.php: groups_action_join_group() |
Catch and process “Join Group” button clicks. |
bp-groups/actions/leave-group.php: groups_action_leave_group() |
Catch and process “Leave Group” button clicks. |
bp-groups/classes/class-bp-group-extension.php: BP_Group_Extension::user_meets_access_condition() |
Check whether the current user meets an access condition. |
bp-groups/classes/class-bp-groups-group.php: BP_Groups_Group::get_group_extras() |
Fetch extra data for a list of groups. |
bp-groups/classes/class-bp-groups-group.php: BP_Groups_Group::get_is_member() |
Checks whether the logged-in user is a member of the group. |
bp-groups/classes/class-bp-groups-component.php: BP_Groups_Component::setup_nav() |
Set up component navigation. |
bp-groups/bp-groups-functions.php: bp_get_user_group_role_title() |
Get the member’s group role |
bp-groups/bp-groups-functions.php: groups_can_user_manage_albums() |
Check whether a user is allowed to manage albums in a given group. |
bp-groups/bp-groups-functions.php: groups_post_update() |
Post an Activity status update affiliated with a group. |
bp-groups/bp-groups-functions.php: groups_is_user_allowed_posting() |
Check whether a user is allowed to post in a given group. |
bp-groups/bp-groups-functions.php: groups_can_user_manage_media() |
Check whether a user is allowed to manage media in a given group. |
bp-groups/bp-groups-functions.php: groups_join_group() |
Add a user to a group. |
bp-groups/bp-groups-activity.php: bp_groups_filter_activity_can_comment() |
Function used to determine if a user can comment on a group activity item. |
bp-groups/bp-groups-template.php: bp_get_group_member_section_title() |
Return the group member section header while in the groups members loop. |
bp-groups/bp-groups-template.php: bp_get_group_join_button() |
Return button to join a group. |
bp-groups/bp-groups-template.php: bp_include_group_by_context() |
Determine whether a group should be included in results sets for a user in a specific context. |
bp-groups/bp-groups-filters.php: bp_groups_user_can_filter() |
Filter the bp_user_can value to determine what the user can do with regards to a specific group. |
bp-friends/bp-friends-functions.php: friends_get_friends_invite_list() |
Get a list of friends that a user can invite into this group. |
bp-friends/classes/class-bp-friends-friendship.php: BP_Friends_Friendship::get_invitable_friend_count() |
Get a count of a user’s friends who can be invited to a given group. |
bp-integrations/learndash/buddypress/Courses.php: Courses::showUserProgress() |
Output user course progress html |
bp-templates/bp-nouveau/includes/activity/functions.php: bp_nouveau_activity_scope_newest_class() |
Add class to newest activities by type. |
bp-templates/bp-nouveau/includes/media/ajax.php: bp_nouveau_ajax_media_get_activity() |
Get activity for the media |
bp-templates/bp-nouveau/includes/groups/ajax.php: bp_nouveau_ajax_joinleave_group() |
Join or leave a group when clicking the “join/leave” button via a POST request. |
bp-templates/bp-nouveau/includes/groups/ajax.php: bp_nouveau_ajax_remove_group_invite() |
AJAX remove group invite. |
bp-core/deprecated/buddypress/1.5.php: groups_at_message_notification() |
Send an email and a BP notification on receipt of an @-mention in a group |
bp-core/bp-core-tools-default-data.php: bp_dd_import_groups_activity() |
Import groups activity – aka “status updates”. |
bp-core/classes/class-bp-email-tokens.php: BP_Email_Tokens::token__group_card() |
Generate the output for token group.card |
bp-activity/bp-activity-functions.php: bp_activity_user_can_read() |
Can a user see a particular activity item? |
bp-activity/bp-activity-template.php: bp_has_activities() |
Initialize the activity loop. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.