Created
June 24, 2019 09:22
-
-
Save mahfelwp/c6bb80166e7c69b91f18ee7b60816d58 to your computer and use it in GitHub Desktop.
Get all users id with custom subscription(membership) level
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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