![]() |
Number of new members statistic on forum home
I wanted to show potential advertisers as well as potential forum members how many people are registering to use our forums every day.
So I wrote this hack to display a 30 day average in the stats box of the forum home. It counts the number of people in user group 2 - registered members, ignoring those people who haven't activated their accounts, yet. It's very easy, takes just a few minutes and requires 1 additional query. You can see it working at www.avforums.com. Please click Install if you use it. Thanks to Bryan Ex for doing a bit of bug fixing help :) |
Great idea... well, at least for active forums. LOL Adding it in today - thanks!
|
Something you will likely get asked about is a query to update the stats after a new install. I can see many not wanting to display 0.00 to start out with.
|
I doubt anyone having done a new install will want to have this hack working for a wee while. Anyway all they'll have to do is revert back to the original FORUMHOME template. Glad you think it's useful.
|
LOL... yeah, that I agree with but what I meant was even for an established board the stats start out at 0 and I would presume it will take a month for them to be accurate (each day that passes getting a little closer). I've done exactly what you've suggested and left it installed but commented out the forum display until later this month when it looks a little better. I'll just have to remember to uncomment next month. Nice hack though and it will be very helpful to me.
|
You could use the round() function to get a whole number out of the average. :)
|
Quote:
PHP Code:
PHP Code:
|
Nice Hack, I like it :)
|
i dont understand how this mod works spinball...
i looked on ur site and it says: New registrations per day (30 day average): 66.20 whats the decimal part for? i thought each new register counts as one and not as a decimal |
It's averaged over a 30 day period... in this case 1986 new joins in 30 days (1986 / 30).
|
o ok, so basicly a percentage... i see now, thx. and nice hack
|
Not a percentage, no. An average.
Yeah how do you show how many people are registering? Just showing the number of people in the last day doesn't represent what is really going on since it could be a particularly busy or quiet day. So it seems fair to show the number of users in the last month or so. Well 30 days. I think it sounds impressive if you quote the number of new users per day as an average with decimal points. It makes you look 'on the ball' with what's happening on your forum. |
Of course, all this assumes that none of your Registered members move into other Usergroups in this time, through Promotions or what have you.
I would probably use something more like PHP Code:
|
I thought about this. For reasonably 'vanilla' boards like ours, there aren't any other user groups. However if I were excluding user groups rather than including them I would exclude banned and awaiting coppa users, too.
|
Quote:
Although, the banned ones are still new members... |
Quote:
Yes banned members can also be considered new members. But if you are being true to yourself and your advertisers, you don't count members who aren't going to contribute. |
Hmmm... something isn't right here. My stats have been at 0.00 all day with over 100 joins. Two lines of code and I've spent an hour trying to figure it out (feeling like a dork the whole time). Has anyone else actually done an install on this one?
|
Is user group 2 registered members, Bryan?
To see it in a manual way, go to your admin CP / Statistics & Logs / Statistics / Registration Statistics and highlight and copy (CTRL+C) the contents of the table (all 3 columns - date, graphic bar and number) into memory. Then open word and paste in there. Highlight and delete the first two columns leaving the table of numbers. Then in Word do a convert table to text. Doesn't matter what seperator is specified. Then copy the lot and paste into an Excel spreadsheet. Sum the numbers (highlight from the top number all the way down to the empty cell below the bottom number and click the sum button). Then in calculator, enter the total and divide by the number of rows (it'll be 30 or 31). And that's your average number of new registrations in total over the last 30 or 31 days. The manual method is long winded and doesn't excluded non-activated registrations, but it's a way to get the numbers wthout hacking. The hack is a lot easier in the long run :) |
Quote:
|
My honest answer is that I don't know - but I wouldn't have thought so.
It being 0.00 would indicate that the numeric value is either not being returned properly from the SQL query or passed from that query though to the data array. Can you run the query on your database to see if that bit works? |
Good idea... I never thought to try that. Running just the query returned a count of 85.77. Just wondering if anyone else has actually installed this and has it working? Not sure how I could screw up two lines of code but if it works for someone else then I at least know it's specific to me and not the code itself.
|
That's an impressive registration rate. If the query is working ok then all you've got to do is get that returned value into the right variable available on the home page.
Can you 'read' php? Have a look at the code to see if it looks right. The code I used in the installation notes came copied from my installation which works perfectly. |
The part I don't understand is that in functions_databuild it refers to $avgregs = yet that variable is not referenced anywhere else - like in index.php for example. Is that correct? If I follow the data process for my site $avgregs would equal 85.77 but what calls that data to index.php? It's as if there's a part missing or something.
|
I think I know what's missing. I believe there should also be an edit to the array in functions_databuild.php...
// make a little array with the data $values = array( 'numbermembers' => $members['users'], 'newusername' => $newuser['username'], 'newuserid' => $newuser['userid'] ); |
This is what I thought it should be but it still isn't right. Could you check your functions_databuild file for this array?
PHP Code:
|
Many apologies - yes you are right.
I omitted that part and have updated the text instructions. Anyone installing so far will need to amend that bit. Thanks for your help. |
Just to confirm... it's now working fine for me. Thanks Spinball.
|
This is strange indeed. I do have a member count showing now but it is incorrect and any changes I make to the query doesn't seem to affect it. For example I changed the user group ID but the same count as before shows or I changed (userid)/30 to /60 which should drop the number by half, again no change. I then thought maybe it's cached somewhere so cleared my temp files and manually ran all board maintenance tasks with no luck. I believe it's really close... but something still isn't quite right unless I'm missing something obvious. Any ideas or suggestions Spinball?
(Can you tell I really want to get this working? LOL) |
It's COUNT(userid)/30 as regcount. What should it be and what is it via the hack?
If you change the 30 to 60 you need to do it in 3 places. The 2 in the SQL statement and the 1 in the phrase. |
Yep, understand that part. What I was getting at was that the stats were not being dynamically updated but I think I now know why. Any changes I make to the query do not take affect until the next person joins. In other words, something has to happen before the number updates (a simple page refresh makes no difference). I think I'm sorted out now so just ignore my ramblings...lol.
|
Thanks, I'll try it.
|
All times are GMT. The time now is 09:20 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|