BP_Groups_Member::get_membership_ids_for_user( int $user_id )
Get all membership IDs for a user.
Description
Parameters
- $user_id
-
(Required) ID of the user.
Return
(array)
Source
File: bp-groups/classes/class-bp-groups-member.php
public static function get_membership_ids_for_user( $user_id ) { global $wpdb; $bp = buddypress(); $group_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d ORDER BY id ASC", $user_id ) ); return $group_ids; }
Changelog
Version | Description |
---|---|
BuddyPress 2.6.0 | Introduced. |
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.