Hey everybody,
I thought this would be simple, but I’m actually stumped. I would like to – in a plugin – count how many users there are, and get the total sum of the contents of a custom field that each user has. So some have 10 or 30 or 200 written in there, and I’d like to print the total sum of that field from all the users somewhere.
My idea was to count all the yaml files in the accounts directory, but I’m not sure how to find that directory without hardcoding the path (could do that, in this case, but it’s hacky). I tried $dir = $locator->findResource('user-accounts://', true);
since that works for the data
directory but that throws a Crikey. And I took a peek at the Admin Addon User Manager plugin, however I feel I won’t understand that quickly enough…
So as always I am super grateful for your ideas! And meanwhile I’ll see if my hacky solution would even work…!!