I am trying to get a list of all users with active subscriptions, but for the life of me can't seem to get something working.
If I look at the users in the dashboard, I see all the active members have a "Abonné" role.
So I've set up my shortcode like this:
function custom_get_members( ){
$args1 = array(
'role' => 'Abonné',
'orderby' => 'user_nicename',
'order' => 'ASC'
);
$subscribers = get_users($args1);
$output = '<ul>';
foreach ($subscribers as $user) {
$output .= '<li>' . $user->display_name.'['.$user->user_email . ']</li>';
}
$output .= '</ul>';
return $output;
}
add_shortcode( 'annuaire', 'custom_get_members' );
But I always get 0 results, even though we have currently over 50 subscribers.
Running the WooCommerce with Subscription and Membership.
Thanks!