Jump to content

Display number of members in a group


Mcardle

Recommended Posts

Hello,

I would like to display on the front end the amount of members in a group that will update automatically. Basically we run a game server where access is purchased through our store and once we have X amount of members with access we upgrade it, we would like to show members how many people have access via the group so they can see how close we are to the next upgrade if that makes sense.

So like what you see in the ACP > Members > Groups but being able to put it in PHP or a block on the front end.

Thanks :) 

Link to comment
Share on other sites

2 hours ago, MadMcardle said:

Sorry Daniel, how do I find out the number of the group? And I would simply change the 4 to that number? At the moment it is just showing the code front end :unsure:

 

Yes, change the 4 to the group id ( which can be found in the URL while editing the group)

You'll need to create a php block as described here:

Link to comment
Share on other sites

  • 4 weeks later...
6 hours ago, Zephers said:

Thanks for this - if I wanted multiple groups in the same block with their counts (like a list) how would you code that?

Create html block

<ul>
	{{foreach \IPS\Member\Group::groups(true, false) as $group}}
		<li>
			{$group->formattedName|raw}: {$group->getCount()}
		</li>
	{{endforeach}}
</ul>

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...