Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mahfelwp/c6bb80166e7c69b91f18ee7b60816d58 to your computer and use it in GitHub Desktop.
Save mahfelwp/c6bb80166e7c69b91f18ee7b60816d58 to your computer and use it in GitHub Desktop.
Get all users id with custom subscription(membership) level
<?php
function get_all_users_id_by_membership_level_id() {
$memberships = rcp_get_memberships( array(
'status' => 'active',
'object_id' => 2 // Membership Levels ID
) );
foreach ($memberships as $membership) {
$customers[] = $membership->get_customer()->get_user_id();
}
$users_id = implode(',', $customers);
return $users_id;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment