[TYPO3-english] Show count of users in usergroup

Jigal van Hemert jigal.van.hemert at typo3.org
Thu Dec 26 10:04:48 CET 2013


Hi,

On 18-12-2013 12:42, Miguel wrote:
> C'mon guys, is this a so weird question that nobody can give some
> advices ? The goal is only to show the number of users from a usergroup
> field ;)

Well, you expect others to do a lot of research for you it seems :-)

>> and i found a snippet that does exactly this, but the problem is
>> that i work with timed usergroups, so the snippet that points to
>> "usergroup" don't work if i redirect to the field that has the
>> timed membership, because the field have more information (the
>> expiration date, etc)

You seem to be using some extension that has a feature "timed usergroups".
First step would be to see what this extension exactly does with the 
"timed" part of the feature and how this information is stored. There is 
a "field that has the timed membership", so figure out what information 
is stored there and in what way.

With that information you can start building a query to select users 
which are currently member of a certain group.

The snippet you've shown in your original post only counts users which 
are only part of exactly one usergroup which matches the one you're 
looking for. If a user is part of more than one usergroup it will be 
stored as a comma separated list of group ID numbers. If you use the SQL 
function FIND_IN_SET() you can find matches in comma separated lists.
This won't help that much with the mysterious "timed memberships", but 
if you know the structure of the data you could build a query that works 
with that too.

-- 
Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the TYPO3-english mailing list