BP_Groups_Member::get_memberships_by_id( int|string|array $membership_ids )

Get group membership objects by ID (or an array of IDs).

Description

Parameters

$membership_ids

(Required) Single membership ID or comma-separated/array list of membership IDs.

Return

(array)

Source

File: bp-groups/classes/class-bp-groups-member.php

1259
1260
1261
1262
1263
1264
1265
1266
public static function get_memberships_by_id( $membership_ids ) {
    global $wpdb;
 
    $bp = buddypress();
 
    $membership_ids = implode( ',', wp_parse_id_list( $membership_ids ) );
    return $wpdb->get_results( "SELECT * FROM {$bp->groups->table_name_members} WHERE id IN ({$membership_ids})" );
}

Changelog

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.