Friends:
I am using the Member Categories add-on from IntoEEtive.com. I’d like to display members who are associated with a particular category (they have submitted channel entries in that category and I have manually assigned them to that category on that basis in the Member Categories control panel). If that was all I wanted to do, it would be easy.
But the wrinkle is that I want to order the list of members by the count of channel entries they have submitted to that category, in descending order.
The Member Categories add-on does not appear to have that capability.
So I’m thinking the query module might help me here, maybe something like this:
{exp:query limit="10" sql="SELECT exp_members.member_id, exp_members.screen_name, exp_members.bio, exp_members.photo_filename, exp_members.photo_width, exp_members.photo_height, exp_channel_titles.author_id, exp_category_members.member_id, count(exp_channel_titles.author_id) AS total FROM exp_members, exp_channel_titles, exp_category_members WHERE exp_members.member_id = exp_channel_titles.author_id AND exp_channel_titles.author_id = exp.category_members.member_id AND exp_category_members.cat_id = {segment_2_category_id} ORDER BY total DESC"}
/images/member_photos/{photo_filename}<strong>{screen_name}</strong>
{bio} <a href="/index.php/site/authors/{member_id}">See all articles by this author ...</a>
{/exp:query}(as you can tell, I’m using Low’s Seg2Cat add-on as well - with the category url_title appearing in segment 2).
In the template where I have the above code, the query only returns one member when, in fact, there are 23 members assigned to the category in question in the Member Categories add-on.
I’m not a SQL expert by any stretch of the imagination (which may be obvious to those of you reading this post! <grin>). I’m wondering if anyone can help me out by telling me what I’m doing wrong in the query.
Thanks in advance for any help you can offer - I really appreciate it!
Frank