We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

A Member list plugin

Development and Programming

Zac G.'s avatar
Zac G.
268 posts
16 years ago
Zac G.'s avatar Zac G.

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 /*******************************/

       
lonelytraveller's avatar
lonelytraveller
38 posts
16 years ago
lonelytraveller's avatar lonelytraveller

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?

       
Zac G.'s avatar
Zac G.
268 posts
16 years ago
Zac G.'s avatar Zac G.

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

       
lonelytraveller's avatar
lonelytraveller
38 posts
16 years ago
lonelytraveller's avatar lonelytraveller

Thanks Zac, I downloaded the latest version and it works perfectly! 😊

       
Jonathan Schofield's avatar
Jonathan Schofield
175 posts
16 years ago
Jonathan Schofield's avatar Jonathan Schofield

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.)

       
Zac G.'s avatar
Zac G.
268 posts
16 years ago
Zac G.'s avatar Zac G.

@watershed,

Thanks for the link to the modification. I haven’t seen that the use of “path:” before. I will have to explore that.

Maybe I will add a few more features to it in the future, although your approach seems like a much simpler solution 😉

       
Jonathan Schofield's avatar
Jonathan Schofield
175 posts
16 years ago
Jonathan Schofield's avatar Jonathan Schofield
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.

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
15 years ago
Brian Litzinger's avatar Brian Litzinger

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.

       
Zac G.'s avatar
Zac G.
268 posts
15 years ago
Zac G.'s avatar Zac G.

Huge thanks Brian! I posted up your revisions as 1.2 in the original post.

       
John St-Amand's avatar
John St-Amand
865 posts
15 years ago
John St-Amand's avatar John St-Amand

This plugin seems like it should meet my need. Where do I find the documentation for it?

       
Zac G.'s avatar
Zac G.
268 posts
15 years ago
Zac G.'s avatar Zac G.

Hi qbmarketing, I never really put any documentation together for the plugin, just what’s in the plugin information page after you install it.

Please let me know if you have any questions, though, and I’ll try to answer them or update the plugin information.

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
15 years ago
Brian Litzinger's avatar Brian Litzinger

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}
       
Zac G.'s avatar
Zac G.
268 posts
15 years ago
Zac G.'s avatar Zac G.

Thanks @litzinger!

       
Macrike's avatar
Macrike
137 posts
15 years ago
Macrike's avatar Macrike

Any chance of getting this to work with 2.0?

       
Zac G.'s avatar
Zac G.
268 posts
15 years ago
Zac G.'s avatar Zac G.

Hey Macrike,

I’m doing some updates on a few other plugins this weekend and I should be able to bang that out 😊

I’ll post up as soon as I have a 2.0 version done, Zac

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.