Forum Academy Marketplace Showcase Pricing Features

How to count the number of registered users

On the surface, this should be a REALLY easy thing to do, but I’m clearly missing something.

What I’m trying to do is have an incremental user ID for each new user as they register. My idea to achieve this was to count the number of existing users than add 1 to the count.

On the signup page, I have a temporary text box for debugging, and my - do a search for users: count - always returns 1. By process of elimination I think it is operating on the current user, rather than the users database.

If I change it to - do a search for vehicles:count - it correctly returns the number of vehicles in the database.

So…what am I doing wrong? Thanks!

As so often happens, the act of formulating the question gave me the answer - my Users database was set up with privacy constraints which meant it was restricted to the current user. With the users database public, the count now works.

Thanks for the help!

1 Like

I dealt with the similar issue last week. The count method you’re using to generate userIDs is not recommended. I’m using a plugin named “Unique IDs” for this purpose. Have a look at it.

I’ll look at the plugin - but out of interest, why is the count method not recommended? In my case, it’s adequate because I’m using the ID for something that has almost zero chance of a collision in the wild - which makes it low risk for me.