![]() |
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*
|
All times are GMT. The time now is 03:08 AM. |
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:
|