Back to vBulletin 3.6 Add-ons

Top Thank Earners (monthly stats) for non-vb pages
Mod Version: 1.02, by LBmtb

This modification is in the archives.
vB Version: 3.6.5 Rating: (2 votes - 2.50 average) Installs: 27
Released: 02 May 2007 Last Update: 04 May 2007 Downloads: 233
Not Supported Is in Beta Stage  

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: https://books.google.com/books?id=iUfIqyAbIU4C&pg=PA272&lpg=PA272&dq=%22cache+db+php%22&source=web&ots=IwUQ4B0bsq&sig=BTW3NXQ4zbI4us1k1sSI7-grRRQ#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: [AJAX] Post Thank You Hack
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: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=webmaster%40socaltrailriders%2eorg&item_name=vb%20Mod&item_number=Recent%20Topics%20Script&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8

Download

This modification is archived, downloads are still allowed.

File Type: %1$s top-thanks1-02.zip (67.6 KB, 205 downloads)

Screenshots

Click image for larger version
Name:	screenshot.jpg
Views:	739
Size:	37.4 KB
ID:	63890  


vblts.ru supports vBulletin®, 2022-2024