The Arcive of vBulletin Modifications Site. |
|
Average age in forumhome Details »»
|
|||||||||||||||||||||||||
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> </if> 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:
Supporters / CoAuthors Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
If you make the plugin use TABLE_PREFIX it will work on every installation, without needing to edit the Plugin
|
|
#3
|
|||
|
|||
|
I know but for some reason that gives a database error!
|
|
#4
|
||||
|
||||
|
Just replace vb3_ with
Code:
" . TABLE_PREFIX . " |
|
#5
|
|||
|
|||
|
That's EXACTLY what I did. It doesn't. Really strange...
|
|
#6
|
|||
|
|||
|
Quote:
|
|
#7
|
|||
|
|||
|
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. Thanks a lot tamarian!
|
|
#8
|
|||
|
|||
|
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 |
|
#9
|
|||
|
|||
|
This took two seconds to add, excellent hack!
|
|
#10
|
|||
|
|||
|
*clicks installed*
|
![]() |
|
|