Forked from mahfelwp/get_all_users_id_with_custom_subscription_level.php
Created
February 24, 2020 13:10
-
-
Save dmasotti/71ecd1c574d83121abae798d7520c6e9 to your computer and use it in GitHub Desktop.
Get all users id with custom subscription(membership) level
This file contains hidden or 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