Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Oct 2006
Posts: 21
Newbie
Newbie
Offline
Joined: Oct 2006
Posts: 21
Ok, here's what I've come up with and it's seemingly working.

To make it as a custom island, first, you need to create a template file, I called mine "island_top_posters_30.tpl"

This file should have this content in it.

PHP Code

{* Script Version 7.3 *}

<?
php if(!defined('UBB_MAIN_PROGRAM')) exit; ?>
{$tbopen}
{section name=user loop=$users}
<div style="float:right">{$users[user].posts}</div>
<a href="{$config.BASE_URL}/ubbthreads.php?ubb=showprofile&User={$users[user].uid}">{$users[user].name}</a><br />
<div style="clear: both"></div>
{/section}
{$tbclose}


This file should be saved in /templates/default directory.

You can name it whatever you want, you just need to match the name in this next bit, which is what you will put into your custom island.

In the custom island, replace the entire contents with the following code...

PHP Code

/* PHP CODE HERE, IF NECESSARY */
// Number of days - Top Posters in X days - Edit as needed
$days = 30;

if (!
defined('UBB_MAIN_PROGRAM')) {
exit;
}

$today = $html -> get_date();
$limittime = ($today - ($days * 86400));


$query = "
SELECT
COUNT(*) as total, p.USER_ID, u.USER_DISPLAY_NAME,
u.USER_MEMBERSHIP_LEVEL, up.USER_NAME_COLOR
FROM
{$config['TABLE_PREFIX']}POSTS as p,
{$config['TABLE_PREFIX']}USERS as u,
{$config['TABLE_PREFIX']}USER_PROFILE as up

WHERE u.USER_ID = up.USER_ID
AND p.POST_POSTED_TIME >
$limittime
AND p.USER_ID != 1
AND p.USER_ID = u.USER_ID
GROUP BY p.USER_ID ORDER BY total DESC
limit
{$config['TOP_POSTERS']}
"
;
$sth = $dbh->do_query($query);
$users = array();
$i = 0;
while(list(
$total,$uid,$username,$memberlevel,$namecolor) = $dbh->fetch_array($sth)) {
$users[$i]['namecolor'] = $html->user_color($username, $namecolor, $memberlevel);
$users[$i]['name'] = $username;
$users[$i]['posts'] = $total;
$users[$i]['uid'] = $uid;
$i++;
}
// end while


$smarty->assign("users",$users);

$island = $smarty->fetch("island_top_posters_30.tpl");

lock_and_write("{$config['FULL_PATH']}/cache/top_post_30.php",$island);

@
chmod("{$config['FULL_PATH']}/cache/top_post_30.php",0666);


/* DO NOT CHANGE THE LINE BELOW */
$body = <<<EOF
<?php include("/your server path here/cache/top_post_30.php") ?>



EOF;
/* DO NOT CHANGE THE LINE ABOVE */


What it does is when it fires based on the timings you've placed, it uses the "island_top_posters_30.tpl" file as a template to create some html code. it then saves this code in your cache directory as "top_post_30.php" or you can change this to be whatever you want as well. It also chmods it so it's usable, and then creates html content and just sucks in the contents of that file for display.

Thing to note is that you need to use your own server path rather than what I wrote near the bottom..i.e. replace "your server path here" with your server path.

I am by no means a fully proficient php coder, I'm more an engineer who can take existing things and make tweaks to get what I want out of them, so, if I've got "not so elegant" codign practices...this is why. Lord knows I couldn't sit down and yield this stuff from scratch.

If one of you more proficient coders notices any major issues, by all means feel free to post corrections...I'm all about function, not form and won't have feelings hurt smile

One final note, the # of people listed is pulled from the Portal Settings page, the # contained within the Top Posters field. I think it makes for a nice symmetry that if you're running both total top posters and top posters over X days that they have the same # of users listed.

Sponsored Links
Entire Thread
Subject Posted By Posted
[7.0.x] Top Posters in Last X Days JoshPet 01/15/2007 6:49 AM
Re: [7.0.x] Top Posters in Last X Days Ian_W 01/15/2007 2:32 PM
Re: [7.0.x] Top Posters in Last X Days Gizmo 01/15/2007 3:02 PM
Re: [7.0.x] Top Posters in Last X Days jgeoff 01/17/2007 12:48 AM
Re: [7.0.x] Top Posters in Last X Days AllenAyres 01/17/2007 2:35 AM
Re: [7.0.x] Top Posters in Last X Days Mark_S 02/26/2007 3:54 AM
Re: [7.0.x] Top Posters in Last X Days Gizmo 02/26/2007 4:22 AM
Re: [7.0.x] Top Posters in Last X Days Mark_S 02/26/2007 12:51 PM
Re: [7.0.x] Top Posters in Last X Days Gizmo 02/26/2007 1:12 PM
Re: [7.0.x] Top Posters in Last X Days Mark_S 02/26/2007 11:53 PM
Re: [7.0.x] Top Posters in Last X Days AllenAyres 02/27/2007 12:30 AM
Re: [7.0.x] Top Posters in Last X Days Ian_W 02/28/2007 12:06 AM
Re: [7.0.x] Top Posters in Last X Days Carte Blanche 06/20/2007 4:31 AM
Re: [7.0.x] Top Posters in Last X Days sirdude 06/20/2007 5:45 AM
Re: [7.0.x] Top Posters in Last X Days Ian_W 06/28/2007 8:43 AM
Re: [7.0.x] Top Posters in Last X Days AshtarRose 10/07/2007 5:40 AM
Re: [7.0.x] Top Posters in Last X Days AshtarRose 10/07/2007 5:58 AM
Re: [7.0.x] Top Posters in Last X Days Gizmo 10/07/2007 6:37 AM
Re: [7.0.x] Top Posters in Last X Days AshtarRose 10/07/2007 7:29 AM
Re: [7.0.x] Top Posters in Last X Days Gizmo 10/07/2007 4:16 PM
Re: [7.0.x] Top Posters in Last X Days Gizmo 10/07/2007 4:17 PM
Re: [7.0.x] Top Posters in Last X Days Ian_W 12/31/2007 7:38 PM
Re: [7.0.x] Top Posters in Last X Days Organizer 01/29/2008 4:05 PM
Re: [7.0.x] Top Posters in Last X Days Organizer 01/29/2008 4:22 PM
Re: [7.0.x] Top Posters in Last X Days Mark_S 02/19/2008 10:37 PM
Re: [7.0.x] Top Posters in Last X Days Ian_W 02/21/2008 2:08 PM
Re: [7.0.x] Top Posters in Last X Days Carte Blanche 02/28/2008 1:15 PM
Re: [7.0.x] Top Posters in Last X Days Mark_S 03/26/2008 10:34 PM
Re: [7.0.x] Top Posters in Last X Days Ian_W 03/28/2008 10:21 AM
Re: [7.0.x] Top Posters in Last X Days willing 05/28/2008 1:59 PM
Re: [7.0.x] Top Posters in Last X Days sirdude 05/28/2008 5:55 PM
Re: [7.0.x] Top Posters in Last X Days AllenAyres 05/30/2008 5:00 AM
Re: [7.0.x] Top Posters in Last X Days willing 05/31/2008 3:43 AM
Re: [7.0.x] Top Posters in Last X Days AllenAyres 05/31/2008 4:42 AM
Re: [7.0.x] Top Posters in Last X Days willing 05/31/2008 5:05 AM
Re: [7.0.x] Top Posters in Last X Days Carte Blanche 05/31/2008 10:58 AM
Re: [7.0.x] Top Posters in Last X Days Carte Blanche 05/31/2008 11:04 AM
Re: [7.0.x] Top Posters in Last X Days Carte Blanche 05/31/2008 12:33 PM
Re: [7.0.x] Top Posters in Last X Days AllenAyres 05/31/2008 6:39 PM
Re: [7.0.x] Top Posters in Last X Days Grymmie 06/11/2008 5:58 PM
Re: [7.0.x] Top Posters in Last X Days sirdude 06/11/2008 7:27 PM
Re: [7.0.x] Top Posters in Last X Days Grymmie 06/12/2008 12:42 AM
Re: [7.0.x] Top Posters in Last X Days Carte Blanche 06/12/2008 3:49 AM
Re: [7.0.x] Top Posters in Last X Days Mark_S 02/27/2007 1:10 AM
Re: [7.0.x] Top Posters in Last X Days JoshPet 02/27/2007 3:50 AM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,575
Posts293,931
Members13,823
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Gizmo 1
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)