Last Updated: February 25, 2016
·
792
· imjakechapman

Expressionengine Members w/ entries count

Easy query to find the number of members with entries

{exp:query sql="
        SELECT count(*) AS num_members
        FROM exp_members m
        JOIN exp_channel_titles t on t.author_id = m.member_id
        Where channel_id='CHANNEL_ID_HERE'"}
{num_members}
{/exp:query}

Maybe you have a channel with a specific status as well?

Example, you have Members who are creating goals, those "goal" entries can either be set to goalset or goalcomplete

you can then find the members that have set goals with

{exp:query sql="
        SELECT count(*) AS num_members
        FROM exp_members m
        JOIN exp_channel_titles t on t.author_id = m.member_id
        Where channel_id='CHANNEL_ID_HERE' AND status='goal_set' "}
{num_members}
{/exp:query}

or the members who have completed goals

{exp:query sql="
        SELECT count(*) AS num_members
        FROM exp_members m
        JOIN exp_channel_titles t on t.author_id = m.member_id
        Where channel_id='CHANNEL_ID_HERE' AND status='goal_complete' "}
{num_members}
{/exp:query}