Get number of subscribers at each level

Hi All,

I would like to be able to display the number of subscribers that I have at each level. Anyone know how to achieve this?

In the past I have used a little plugin that displays total number of users on the website but can’t see how to get these values for S2member levels.

Many thanks in advance,

Gareth

Try this:

<?php
echo count(get_users('role=subscriber'));
?>

You may need to set the role for each level. Note that in large number of members this can be slow, needs a faster code, but that needs direct access to DB…

Much obliged Krum!

That worked well. For anyone else wanting to do the same … the S2member role labels do not get picked up. Instead, you need to use the levels in this format

s2member_level1

Best wishes,
Gareth