Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Average age in forumhome Details »»
Average age in forumhome
Version: 1.03, by Lea Verou Lea Verou is offline
Developer Last Online: Jul 2012 Show Printable Version Email this Page

Version: 3.5.3 Rating:
Released: 10-24-2005 Last Update: 10-24-2005 Installs: 59
Uses Plugins Template Edits
 
No support by the author.

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>
Add below:
HTML Code:
Average Age: $avg_age
You're done!
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:
  • In the plugin manager click Avg Age in order to edit the plugin code.
  • Find DAYOFYEAR(NOW())) / 365), 2) and change the 2 in green to the number of decimals you like.

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 10-25-2005, 02:16 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you make the plugin use TABLE_PREFIX it will work on every installation, without needing to edit the Plugin
Reply With Quote
  #3  
Old 10-25-2005, 02:23 PM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know but for some reason that gives a database error!
Reply With Quote
  #4  
Old 10-25-2005, 02:33 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just replace vb3_ with
Code:
" . TABLE_PREFIX . "
and it should work fine.
Reply With Quote
  #5  
Old 10-25-2005, 02:37 PM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's EXACTLY what I did. It doesn't. Really strange...
Reply With Quote
  #6  
Old 10-25-2005, 04:42 PM
tamarian tamarian is offline
 
Join Date: Oct 2001
Location: Canada
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Loukrhtia
That's EXACTLY what I did. It doesn't. Really strange...
Make sure when you add TABLE_PREFIX that you remove vb3_
Reply With Quote
  #7  
Old 10-25-2005, 04:48 PM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #8  
Old 10-25-2005, 04:57 PM
Boots Boots is offline
 
Join Date: Dec 2004
Posts: 172
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
replace 1950 with any cutoff date... on my forum where I was an old phpbb forum I have some birthdays in there of 1900 for some reason so that addition makes the query more accurate.
Reply With Quote
  #9  
Old 10-25-2005, 05:32 PM
Extreme John Extreme John is offline
 
Join Date: Nov 2004
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This took two seconds to add, excellent hack!
Reply With Quote
  #10  
Old 10-25-2005, 05:59 PM
Moncal Moncal is offline
 
Join Date: Mar 2005
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*clicks installed*
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:22 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10981 seconds
  • Memory Usage 2,295KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (2)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete