Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
Top Thank Earners (monthly stats) for non-vb pages Details »»
Top Thank Earners (monthly stats) for non-vb pages
Version: 1.02, by LBmtb LBmtb is offline
Developer Last Online: Aug 2015 Show Printable Version Email this Page

Category: Statistics Modifications - Version: 3.6.5 Rating:
Released: 05-01-2007 Last Update: 05-03-2007 Installs: 27
Is in Beta Stage  
No support by the author.

Top Thank Earners (monthly stats) for non-vb pages
Version: 1.02
Author: LBmtb[/email]
Last updated: May 3nd, 2007



DESCRIPTION:

This displays the top X thank earners in X month. The X's are configurable. You can have multiple tables in a single page. For example: you can have "Top 20 in May 2007" and have "Top 5 in April 2007" or any other combination you can think of.

The table it produces is a plain jane table but can be styled with CSS. The table's class is "top_thanks" and the rows have alternating classes ("odd" and "even") in case you want to do alternating colors for the rows. Here's what it looks like:

HTML Code:
<table width="100%" cellpadding="0" cellspacing="0" summary="two months ago" class="top_thanks">
<th scope="col">Position</th><th scope="col">Username</th><th scope="col">Thanks Earned</th>
<tr class="odd">
<td scope="row">1</td>
<td><a href="http://localhost/forum/member.php?u=610">Winston</a></td>
<td><a href="http://localhost/forum/search.php?do=findthanks&u=610">97</a></td>
</tr>						
<tr class="even">
<td scope="row">2</td>
<td><a href="http://localhost/forum/member.php?u=191">LBmtb</a></td>
<td><a href="http://localhost/forum/search.php?do=findthanks&u=191">71</a></td>
</tr>
</table>
vbSEO URLs and caching the queries are both optional. By default they are not used. Please see #3 of the instructions.

If using the caching technique ... the queries are cached for an hour to speed up the page and reduce server load. For more on the PEAR cacheing stuff, read this: http://books.google.com/books?id=iUf...rRRQ#PPA272,M1

A basic understanding of PHP (or be able to follow directions very well) will help a lot here.


VERSION HISTORY:

1.00: Initial release
1.01: Made using the cached technique optional.
1.02: Cleaned stuff up. Made it a bit easier to use and configure.


REQUIREMENTS:

1) Pear must be setup on your server to use the cached technique. You MIGHT need to do an ini_set() to get the Cache/DB.php available to you.
2) vbSEO is optional. See instructions for how to get vbSEO'ized member urls.
3) Abe's Post Thank You Hack. You may download it here: https://vborg.vbsupport.ru/showthread.php?t=122944
4) The page you use this on needs to have a php extension or if it's html, parse it as php (you can set this in htaccess)


INSTALLATION INSTRUCTIONS:

1) Open thanks1-02.php and fill in variables under "FILL IN STUFF BELOW, mk?"

2) Upload thanks1-02.php to your site (same directory where your top thank earner page will be)

3) On the stats page, add the following somewhere before the stats and change first two variables if you'd like:

PHP Code:
<?php
// change to true if you wish to use either of the following ...
$vbseo_urls false;
$cached_technique false;

if (
$cached_technique)
{
    require 
'Cache/DB.php';
}

if (
$vbseo_urls)
{
    include_once 
"forum/includes/functions_vbseo.php"
}

require 
"thanks1-02.php";
?>
4) Wherever you want a top thank earners table to appear, put in the following code and configure it a bit (look over the comments):

PHP Code:
<?php

// NOTE: "$thisMonth" variable should be different for each table you're making (each instance of thanks class)

    
$thisMonth = new thanks($start_epoch,$end_epoch); 
    
/*    
         $start_epoch (optional): Epoch timestamp of time for earliest thanks (beginning of month usually). Defaults to beginning of current month.
         $end_epoch (optional): Epoch timestamp of time for latest thanks (end of month usually). Defaults to end of current month.
    */
    
    
$thisMonth->grab_n_sort($string,$vbseo_url,$cached_technique); 
    
/*
        $string (required): Any variable name in form of a string (should be different for each table) 
    */
    
    
$thisMonth->print_chart($top_x,$table_summary); 
    
/*
        $top_x: is top x thanks earners to show in number format
        $table_summary: for the table's summary attribute
    */
?>
The previous make a table for the current month. For months other then the current month...
thanks() takes two optional arguments. Those arguments are epoch values for the beginning and end of a different month.

Example 1: For stats from two months ago, do this:

PHP Code:
$start_epoch mktime(000, (date(m)-2), 1date(Y));  // epoch for beginning of month
    
$end_epoch mktime(23590, (date(m)-1), 0date(Y));  // epoch for end of month

    
$twoMonthsAgo = new thanks($start_epoch,$end_epoch); 
Example 2: For stats one month ago:

PHP Code:
$start_epoch mktime(000, (date(m)-1), 1date(Y)); // beginning of month epoch ex. 01/01/07 12:00 AM
    
$end_epoch mktime(23590, (date(m)), 0date(Y)); // end of month epoch ex. 01/31/07 11:59 PM

    
$oneMonthAgo = new thanks($start_epoch,$end_epoch); 

DEMO:

http://www.socaltrailriders.org/top-thanks.php


HELP/TROUBLESHOOTING:

I will try and support this mod as much as time allows on the vBulletin.org thread. Customizations to your own website can be done for a fee. PM me about that if necessary.


COPYRIGHT:

Please do not remove the copyright from the script.

DONATE:

If you use and appreciate this script, please say thank you by donating something: Donate

Show Your Support

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

Comments
  #12  
Old 05-04-2007, 01:33 AM
tanyeri24 tanyeri24 is offline
 
Join Date: Feb 2005
Location: Switzerland
Posts: 229
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Its working for you?
Reply With Quote
  #13  
Old 05-04-2007, 02:40 AM
LBmtb LBmtb is offline
 
Join Date: Jan 2006
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tanyeri24 View Post
Its working for you?
I made a new version of it. Hopefully it's easier to use and configure. By default vbSEO URLs and using the cached queries technique is turned off. Make sure you read the instructions.

Let me know if that works for ya!
Reply With Quote
  #14  
Old 05-04-2007, 02:50 AM
LBmtb LBmtb is offline
 
Join Date: Jan 2006
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RMS-Chef View Post
What kind of queries are involved here and can I alter it to update cache like every 12 hours instead? I just get a little worried since I have over 1.3 million "thanks" issued on my board. Thanks for any advice you may be able to give.
The query is:
Code:
SELECT p.username, p.userid
FROM {$this->db_prefix}post_thanks t INNER JOIN {$this->db_prefix}post p 
ON t.postid = p.postid 
WHERE t.date BETWEEN ". $this->beginning ." AND ". $this->end_month ."
ORDER BY date DESC
You CAN change the option for how long it takes to refresh the query. You'd have to supply constructor arguments to the class when you create the instance of it (in the php file). For a thourough rundown on what arguments it takes and how to do it, check out this link. It's on the last paragraph of page 272 and then beginning of the next page.

Let me know if you need help with that. Good luck!
Reply With Quote
  #15  
Old 05-04-2007, 03:51 AM
Hornstar Hornstar is offline
 
Join Date: Jun 2005
Location: Australia
Posts: 2,469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hey nice work, i always like to see more hacks for non vb pages. ill give this a go another day tho. thanks.
Reply With Quote
  #16  
Old 05-04-2007, 04:32 PM
tanyeri24 tanyeri24 is offline
 
Join Date: Feb 2005
Location: Switzerland
Posts: 229
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by LBmtb View Post
I made a new version of it. Hopefully it's easier to use and configure. By default vbSEO URLs and using the cached queries technique is turned off. Make sure you read the instructions.

Let me know if that works for ya!
Hi thanks for update. I get only a blank page with the codes in 3). At 4) I've again error code like this:
Code:
Fatal error: Cannot instantiate non-existent class: thanks in /usr/www/users/xxx/xxx.php on line 5
:erm:
Reply With Quote
  #17  
Old 05-15-2007, 08:36 AM
fn9mm fn9mm is offline
 
Join Date: Oct 2005
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Got it working for 1 month, however I'm experiencing probs when i want to display 2 months or more (PHP NOOB here )

Code for 1 month (working)
Code:
<?php
// change to true if you wish to use either of the following ...
$vbseo_urls = false;
$cached_technique = false;

if ($cached_technique)
{
	require 'Cache/DB.php';
}

if ($vbseo_urls)
{
	include_once "forum/includes/functions_vbseo.php"; 
}

require "thanks1-02.php";
?>
<?php
// NOTE: "$thisMonth" variable should be different for each table you're making (each instance of thanks class)
//        $string (required): Any variable name in form of a string (should be different for each table)  


// 2 months ago
$start_epoch = mktime(0, 0, 0, (date(m)-2), 1, date(Y));  // epoch for beginning of month 
$end_epoch = mktime(23, 59, 0, (date(m)-1), 0, date(Y));  // epoch for end of month 

$twoMonthsAgo = new thanks($start_epoch,$end_epoch);
$twoMonthsAgo ->grab_n_sort($string,$vbseo_url,$cached_technique); 
$twoMonthsAgo ->print_chart(10,$table_summary);
	
?>
Code for 2 months (results in blank page)
Code:
<?php
// change to true if you wish to use either of the following ...
$vbseo_urls = false;
$cached_technique = false;

if ($cached_technique)
{
	require 'Cache/DB.php';
}

if ($vbseo_urls)
{
	include_once "forum/includes/functions_vbseo.php"; 
}

require "thanks1-02.php";
?>
<?php
// NOTE: "$thisMonth" variable should be different for each table you're making (each instance of thanks class)
//        $string (required): Any variable name in form of a string (should be different for each table)  


// 2 months ago
$start_epoch = mktime(0, 0, 0, (date(m)-2), 1, date(Y));  // epoch for beginning of month 
$end_epoch = mktime(23, 59, 0, (date(m)-1), 0, date(Y));  // epoch for end of month 

$twoMonthsAgo = new thanks($start_epoch,$end_epoch);
$twoMonthsAgo ->grab_n_sort($string,$vbseo_url,$cached_technique); 
$twoMonthsAgo ->print_chart(10,$table_summary);
	
// 1 month ago	
$start_epoch = mktime(0, 0, 0, (date(m)-1), 1, date(Y)); // beginning of month epoch ex. 01/01/07 12:00 AM 
$end_epoch = mktime(23, 59, 0, (date(m)), 0, date(Y)); // end of month epoch ex. 01/31/07 11:59 PM 

$oneMonthAgo = new thanks($start_epoch,$end_epoch);  
$oneMonthsAgo ->grab_n_sort($string,$vbseo_url,$cached_technique); 
$oneMonthsAgo ->print_chart(10,$table_summary);
?>
What am I doing wrong?
I guess it has something to do with the $string ?
What should i use in stead of $string for the other months,....?
tia
Reply With Quote
  #18  
Old 05-15-2007, 10:00 AM
fn9mm fn9mm is offline
 
Join Date: Oct 2005
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Solved like this,
is this a good code?
Code:
// This month 
$string = 'thismonth';
$thisMonth = new thanks($start_epoch,$end_epoch);  
$thisMonth->grab_n_sort($string,$vbseo_url,$cached_technique);  
$thisMonth->print_chart(10,$table_summary); 

// 1 month ago
$start_epoch = mktime(0, 0, 0, (date(m)-1), 1, date(Y));  // epoch for beginning of month 
$end_epoch = mktime(23, 59, 0, (date(m)), 0, date(Y));  // epoch for end of month 
$string = 'oneMonthsAgo';

$twoMonthsAgo = new thanks($start_epoch,$end_epoch);
$twoMonthsAgo ->grab_n_sort($string,$vbseo_url,$cached_technique); 
$twoMonthsAgo ->print_chart(10,$table_summary);

// 2 months ago
$start_epoch = mktime(0, 0, 0, (date(m)-2), 1, date(Y));  // epoch for beginning of month 
$end_epoch = mktime(23, 59, 0, (date(m)-1), 0, date(Y));  // epoch for end of month 
$string = 'twoMonthsAgo';

$oneMonthsAgo = new thanks($start_epoch,$end_epoch);
$oneMonthsAgo ->grab_n_sort($string,$vbseo_url,$cached_technique); 
$oneMonthsAgo ->print_chart(10,$table_summary);
Reply With Quote
  #19  
Old 07-18-2007, 11:35 AM
bollie's Avatar
bollie bollie is offline
 
Join Date: Jun 2006
Location: Zele (Belgium)
Posts: 259
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice
Reply With Quote
  #20  
Old 08-20-2007, 07:03 PM
vitrag24's Avatar
vitrag24 vitrag24 is offline
 
Join Date: Nov 2006
Location: India
Posts: 639
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

when it'll be in alpha stage?
Reply With Quote
  #21  
Old 09-15-2007, 02:17 PM
vitrag24's Avatar
vitrag24 vitrag24 is offline
 
Join Date: Nov 2006
Location: India
Posts: 639
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no alpha yet?
Reply With Quote
Reply

Thread Tools

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 07:14 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
  • Page Generation 0.05216 seconds
  • Memory Usage 2,346KB
  • Queries Executed 25 (?)
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
  • (5)bbcode_code
  • (1)bbcode_html
  • (4)bbcode_php
  • (3)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
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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