![]() |
Average age in forumhome
This is a modification I really wanted for my forum and I am posting it cause I thought that others may find it useful as well. However, I only had the idea as Xenon helped my really much with the query (My SQL knowledge is very basic and this is why this hack isn't supported, I wish I could support it but I don't have the knowledge to do so).
Thanks also to tamarian for fixing the issue with the table prefix. :) Instructions 1. Import the attached XML file. It's a plugin, not a product :) 2. Edit template FORUMHOME: Find: HTML Code:
<span title="<phrase 1="$vboptions[activememberdays]">$vbphrase[within_the_last_x_days]</phrase>">$vbphrase[active_members]: $activemembers</span> HTML Code:
Average Age: $avg_age If you liked this and you are using it, don't forget to click INSTALL! If you want less or more than 2 decimals at the average then:
|
If you make the plugin use TABLE_PREFIX it will work on every installation, without needing to edit the Plugin :)
|
I know but for some reason that gives a database error! :(
|
Just replace vb3_ with
Code:
" . TABLE_PREFIX . " |
That's EXACTLY what I did. It doesn't. Really strange...
|
Quote:
|
I did! I'll test the attached plugin and if it causes no db errors in my test forum I'll update the attachment :)
Thanks :) edit: Yep, no database errors. I still can't figure out what I was doing wrong, lol. :p :) Thanks a lot tamarian! :D |
I'd change the query to something like
Code:
SELECT ROUND(AVG(YEAR(NOW()) - YEAR(birthday_search) - (DAYOFYEAR(birthday_search) - DAYOFYEAR(NOW())) / 365), 2) AS avgage WHERE YEAR(birthday_search) > 1950 |
This took two seconds to add, excellent hack!
|
*clicks installed*
|
Installed!
|
Quote:
Quote:
|
How would you integrate this with vbadvanced? I found the template to insert it into but it's not showing a value for age.
|
Quote:
What do you mean "integrate it with vbadvanced"? You want it to show in the stats block? Also, the most common reasons for it not showing a value for age: 1. You haven't done the template change correctly 2. The plugin isn't enabled 3. If you have the very first version of the hack, you haven't entered the database perfix correctly (if that's the case you would get a db error as well) Do you get any errors or the number just doesn't show? |
Hm, funny little thing this :D Thanks!
*installs* |
Thank you :)
What is funnier is the way I came up with it! :p Some people (a very annoying competitor as well) that had only seen a little of my forum were saying that it has a very low level of average age which I knew was not true. So I put that in the forumhome and when they saw average age 29 they shut their mouths :D |
Quote:
|
This didnt work in my forum.
Edit; it works fine, thanxs! :) |
What does it show?
|
Quote:
|
did you solve the problem?
|
Yes, i did at first place "Average Age: $avg_age" above if.
|
works well, thanks
|
It's not displaying anything for me...
this is what I see: "Average Age: " I upgraded from 3.0.0 RC4 and my forumhome template does show up (in admincp home) as one of the templates that has been updated. But I cant find anything in there that would cause this code not to work, I just put it in the code right after the member count btw. This is on a password protected test forum, not the one listed in my profile. |
Excellent little addition.
I have one forum member (oldest guy on the forums) always saying everyone is so young, yada yada yada.... Now he can eat some humble pie. :D Thanks a ton. |
Is the plugin enabled yowen?
|
yes it is.
|
Hi,
thx for this hack? But one question, how does it calculate the age? In my forum 50 % doesn't have fill out her age, coz it not necessary for getting registered. Does it only use those with an age in the profile or does it use all member? For example you have 4 Members, all are 20 years old but only 3 have fill out their age, so will it calculate 60:3 = 20 or 60:4=15 Sorry for my bad english |
I calculates from all members that have entered a date :)
|
Quote:
|
Quote:
In what particular way can your comment be considered "constructive"? |
Quote:
|
Quote:
Quote:
I didn't mean to be offensive or anything. |
Wanted to let ya'll know this works in 3.6. However I didn't like where it displayed the age, thought it was kinda of weird, makes it look like it's implying it's the age of the members currently signed in.
Instead, I wanted it next to the member total in the navbar. See here for instructions on how to do this, I think it looks a lot better: http://www.vbstyles.com/forum/showthread.php?t=3155 |
Quote:
Quote:
|
Great ... still works with 3.8.2! THX!
|
Quote:
|
Unfortunately it don`t works with vBulletin 4.
Could please someone take a look on this cool Plug-in? |
All times are GMT. The time now is 04:50 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:
|