Hi EEers,
For a site I am developing we needed a way to output a list of members from a certain group and have the list link to page where you would see a bio of the group member and a list of articles they have written.
So, using the plugin like so:
{exp:memberlist member_group="1" url="{path=site/articles}" url_extension="member_id"}
Gives you this:
<li><a href="http://site.com/articles/1">Zac Gordon</a> <span class="member_group_titles">Super Admin</li>
<li><a href="http://site.com/articles/2">Saqib Ashraf</a> <span class="member_group_titles">Super Admin</li>
We could use the memberlist features that EE and the forum module has built in, but this was on a smaller, more specific scale. Originally we used the query module to do what we needed, but soon found that a plugin would make our lives easier.
There are some extra features, like the ability to use the username in the url instead of the member_id. You can also output the title of the member group that the member belongs to.
/********* Update Log: *********/
1.1 Added the ability to be able to orderby screen_name, username, or member_id and sort asc or desc. 1.2 Brian Litzinger added ability for multiple group ID declarations; converted from a single tag to a tag pair so you can control the markup of the results; added a parameter to only get members who have any blog/entry posts. 1.3 Bug fix for a sql query /*******************************/
Hello Zac, I’ve just downloaded your plug-in and it works like a charm. This is just what I’ve been looking for, thank you!
I just wanted to ask you a question: since the output is an unordered list where members are sorted by id, is there a way to sort them alphabetically (or in any other way)? Or is it a feature you’re planning to add in the future?
Hi LonelyTraveller,
I just wanted to ask you a question: since the output is an unordered list where members are sorted by id, is there a way to sort them alphabetically (or in any other way)? Or is it a feature you’re planning to add in the future?
Can’t believe I didn’t think of that the first time ‘round.
I added the ability to be able to orderby screen_name, username, or member_id and sort asc or desc.
Just check the documentation for the plugin for the details.
You can get the latest copy from the original post.
Please let me know if you have any issues or other ideas.
Glad to hear it is helpful to you!
Cheers, Zac
FYI:
Zac, this is a great plug-in and I was going to adapt it for my need (a Member List page with avatars and other info) until Sue Crocker helped me customise the Member List Rows segment of the Member Profile template accordingly.
(Nice use of the poll option BTW, which I hadn’t twigged to. More use should be made of it, methinks.)
seems like a much simpler solution
Well, yes and no. It depends on how things play out with EE2 with regard to this issue. There was a promising hint yesterday from Sue.
Zac G, I found this post and your original plugin and needed a bit more flexibility, so I tweaked it a bit (ok, a lot).
The main thing I did was allow for multiple group ID declarations, and instead of sending back a UL, I turned the plugin into a tag pair, instead of a single tag. I also added a param to only get members who have any blog/entry posts.
edit: removed code, plugin available for download above.
Here is how you use my modified version:
Example with all the available parameters and variables in use. Only member_group is required. The rest are optional.
It basically lists all the members, and can optionally return the total number of posts/entries the member is the author of in the defined weblogs. has_posts will only return members who have a post in ANY weblog, but if you want to restrict what weblog they have posts in, just use the weblog=”” parameter.
{exp:members:loop member_group="6|7|8" has_posts="y" weblog="blog|news"}
<li><a href="#">{screen_name} ({total_posts}) {username} {member_id}</li>
{/exp:members:loop}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.