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

New Plugin - Member Group Count…

Development and Programming

Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Hi there,

Another simple one this in response to the thread here. Just thought I’d have a go at making something to do this 😉

Basically this plugin returns the group name, group ID and a count for the members in the group.

USAGE

MULTIPLE GROUPS

<h2>Multiple Groups</h2>
{exp:member_group_count:multiple_groups groups="1|2|3|4|5|6"}

Group ID = {group_id}

Group Count = {group_count}

Group Title = {group_title}


<hr >
{/exp:member_group_count:multiple_groups}

PARAMETERS groups=”1|2|3|4|5|6” Pipe delimited list of member group ids

VARIABLES Use of {switch="Aye|Bee|Sea|Dee"} variable permitted


ONE GROUP

<h2>One Particular Group</h2>
{exp:member_group_count:one_group group="1"}

Group ID = {group_id}

Group Count = {group_count}

Group Title = {group_title}


<hr >
{/exp:member_group_count:one_group}

PARAMETERS group=”1”


ALL GROUPS WITH MEMBERS

<h2>All Groups With Members</h2>
{exp:member_group_count}
{switch="Aye|Bee|Sea|Dee"}

Group ID = {group_id}

Group Count = {group_count}

Group Title = {group_title}


<hr >
{/exp:member_group_count}

VARIABLES Use of {switch="Aye|Bee|Sea|Dee"} variable permitted

Hope it’s of help to someone out there.

Best wishes,

Mark

       
Philip Zaengle's avatar
Philip Zaengle
293 posts
16 years ago
Philip Zaengle's avatar Philip Zaengle

Thanks Mark, I’ll keep this one in the back of my head.

I love “{switch=“Aye|Bee|Sea|Dee”}” haha

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Hiya,

Thanks for the post 😉 I am still trying to update this one so that if the group has no members then you will get 0 for the count other than at the moment you don’t get any output.

Actually in the single group it does do this and will show a zero count if there are indeed no members in that group but I need to update the multiple groups tags so that they spit out a zero count. The plugin will still work fine just won’t give any output at all for empty groups.

Hope it’s useful though.

As for the Aye, Bee, Sea, Dee that’s how you spell those letters isn’t it? 😉 😊 😉

Best wishes,

Mark

       
wecreateyou's avatar
wecreateyou
86 posts
15 years ago
wecreateyou's avatar wecreateyou

Hi Mark, This is a handy little thing. Thanks as always for sharing.

I was wondering what the easiest way to pull member-count for a particular day of the week or specific date? Any Ideas?

Thanks again.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
15 years ago
Mark Bowen's avatar Mark Bowen
Hi Mark, This is a handy little thing. Thanks as always for sharing.

No problem at all. 😊

I was wondering what the easiest way to pull member-count for a particular day of the week or specific date?

Do you mean when they registered or something else?

Best wishes,

Mark

       
wecreateyou's avatar
wecreateyou
86 posts
15 years ago
wecreateyou's avatar wecreateyou

Yes, I had an idea not sure how useful yet. I just want to count the number of members currently in the group. So this number would increase each time a member signs up. Next I want to basically make an array that has the members count for each day of the week.

Like this:

var myvalues = [
        
{exp:member_group_count:one_group group="5"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5"}{group_count}{/exp:member_group_count:one_group},
        
];

of course that will output same number of members each time.

[9,9,9,9,9,9,9]

If I had a parameter that could limit the results to maybe day1,day2,day3 etc. (So day1 would be today, day2 would be yesterday, day3 would be day before yesterday and so on.

var myvalues = [
        
{exp:member_group_count:one_group group="5" offset_day="day1"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5" offset_day="day2"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5" offset_day="day3"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5" offset_day="day4"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5" offset_day="day5"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5" offset_day="day6"}{group_count}{/exp:member_group_count:one_group},
{exp:member_group_count:one_group group="5" offset_day="day7"}{group_count}{/exp:member_group_count:one_group},
        
];

[9,13,25,23,35,44,50]

each number would be the count for a day of the week. (Monday - Sunday) So I will feed this data into a charting script and get the last seven days at a glance.

…also I just thought about adapting this to entry activity which should be a bit easier with the parameters available in the weblog entries tag.

Thanks for “noodling” this with me. This is just an Idea I had and it’s not mission critical or anything. Thanks.

       
emagine media's avatar
emagine media
65 posts
15 years ago
emagine media's avatar emagine media

Hey Mark,

Any way to adjust so a group can be excluded? something like:

{exp:member_group_count:multiple_groups groups="not 1"}

or

{exp:member_group_count:multiple_groups groups!="1"}
       
Mark Bowen's avatar
Mark Bowen
12,637 posts
15 years ago
Mark Bowen's avatar Mark Bowen

Hiya,

Hey Mark, Any way to adjust so a group can be excluded? something like:
{exp:member_group_count:multiple_groups groups="not 1"}
or
{exp:member_group_count:multiple_groups groups!="1"}

At the moment there isn’t but I am working on a new version which will have an exclude_groups=”1|2|3” parameter. Will hopefully have that ready as soon as possible so watch this space 😉

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
15 years ago
Mark Bowen's avatar Mark Bowen

Hiya,

I have a new version of the plugin now available. I’m going to add it to this entry in the post but once I’ve kicked it around quite a bit more then I will add it to the top post. If you can kick it around too to see if anything breaks then that would help me out massively as then having at least two people playing with it should show me if I’ve done anything wrong anywhere.

Hope it works okay for you.

Usage Instructions

Single Group
{exp:mb_member_group_count:single_group group="5"}
Group ID = {mb_group_id}

Group Count = {mb_group_count}

Group Name = {mb_group_title}

{/exp:mb_member_group_count:single_group}
Parameter group=”5” Provide a single group ID using this parameter and if there are results for this member group then they will be returned. All Groups (with exceptions)
{exp:mb_member_group_count:all_groups exclude_groups="5|6|7"}
Group ID = {mb_group_id}

Group Count = {mb_group_count}

Group Name = {mb_group_title}

<hr >
{/exp:mb_member_group_count:all_groups}
Parameter exclude_groups=”5|6|7” If this parameter is provided then all groups except those listed in the parameter will be returned. If left empty or not supplied then all groups with data in will be returned.

Hopefully it all should work fine though.

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
15 years ago
Mark Bowen's avatar Mark Bowen

Well just noticed on silly thing just by looking at my usage examples above. Why would I want to use the multiple_groups version with an exclude_groups=”5” parameter when I just supplied 5 in the groups parameter? 😊

I will probably just update the plugin to have just the single_group and all_groups functions and then with the all_groups function include the exclude_groups=”5” parameter.

Pretty silly of me to exclude something I’d just included!! 😊

Will get this done first thing tomorrow now.

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
15 years ago
Mark Bowen's avatar Mark Bowen

Plugin usage and plugin now updated and can be found two entries above this one.

Will leave it there for a while until it’s been played with a lot and to see if anyone can break it. Please let me know if it does break. If not then I’ll move it on up to the top entry for all to find easily.

Best wishes,

Mark

       
emagine media's avatar
emagine media
65 posts
15 years ago
emagine media's avatar emagine media

you sir are a poet and a gentleman.

I am going to give this a play tonight and get back to you.

       
emagine media's avatar
emagine media
65 posts
15 years ago
emagine media's avatar emagine media

looks really good and the exclude does what it says on the tin.

The only problem is losing the ability to give out multiple groups. I would use multiple groups with the |, like this:

{exp:mb_member_group_count:single_group group="9|10"}
Group ID = {mb_group_id}

Group Count = {mb_group_count}

Group Name = {mb_group_title}

{/exp:mb_member_group_count:single_group}

And this would count the two groups up (I have them ad group and group admin with differing permissions, this the reason for this setup)

       

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.