Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Mod Name / Version: Top Posters in X Days

Description: This changes the Top Posters Portal box to reflect top posters in last X days
which keeps the list more current. Otherwise the same people tend to stay on that list.

Working under: 7.0.2

Any pre-requisites: none

Author: JoshPet www.JoshuaPettit.com
for discussion and bugs go to www.ubbdev.com

Date: 1/14/07

Credits: One of my clients for commissioning it

Files Altered: /cache_builders/top_posters.php, /languages/english/island_top_posters.php

Database Altered: none

Info: Make this modification, set the number of days you'd like to use, and clear your cache

Attachments
2339-TopPostersLastXDays.txt (2.11 KB, 181 downloads)

Sponsored Links
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Works fine in 7.1 - only difference being the location of the language string.


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Jan 2000
Posts: 5,833
Likes: 20
UBBDev / UBBWiki Owner
Time Lord
UBBDev / UBBWiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,833
Likes: 20
Looks good Josh, keep up the good work smile


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, My UBB Scripts
Joined: Apr 2001
Posts: 96
Power User
Power User
Joined: Apr 2001
Posts: 96

Nice idea!

What if I wanted to have both though?
Could it be converted to a custom island?


GangsterBB.NET (Ver. 7.3)
2007 Content Rulez Contest - Honorable Mention
UBB.classic 6.7.2 - RIP
Browser: Firefox 2.0
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Yes, you'd need to add the appropriate code into your custom island tho. (php code above to the top and the template code down below).


- Allen wavey
- What Drives You?
Sponsored Links
Joined: Nov 2003
Posts: 329
Beta Tester
Beta Tester
Offline
Joined: Nov 2003
Posts: 329
Does anyone have the Code for this as Custom Island.
Ive been trying but get an error when i submit it?

Its probably because i havnt split it correctly like Allen sugests.

Thanks in advance.

Mark.


BOOM 7.6.+ rocks....
Joined: Jan 2000
Posts: 5,833
Likes: 20
UBBDev / UBBWiki Owner
Time Lord
UBBDev / UBBWiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,833
Likes: 20
This only works in 7.0; see this for 7.1


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, My UBB Scripts
Joined: Nov 2003
Posts: 329
Beta Tester
Beta Tester
Offline
Joined: Nov 2003
Posts: 329
Gizmo there two diffrent subjects.
I have that one running you linked too.

Ive seen this "Top Posters in Last X Days "
Running on a 7.1 board, Ian W's.

I think its a really neat addon,
but i'm having problems with the code.

Maybe Ian would be so kind to share the code?

Mark.


BOOM 7.6.+ rocks....
Joined: Jan 2000
Posts: 5,833
Likes: 20
UBBDev / UBBWiki Owner
Time Lord
UBBDev / UBBWiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,833
Likes: 20
Sorry, it was late when i posted, i was confusing it for another mod; but I haven't heard of this running succuessfully in 7.1 other than ian's forum


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, My UBB Scripts
Joined: Nov 2003
Posts: 329
Beta Tester
Beta Tester
Offline
Joined: Nov 2003
Posts: 329
I'm going to have another go at this tonight.
Probably screw it up lol...

If i get it working will post below. 7.1


BOOM 7.6.+ rocks....
Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Should be pretty much the same code, with the exception of Ian's noted language string difference.


- Allen wavey
- What Drives You?
Joined: Nov 2003
Posts: 329
Beta Tester
Beta Tester
Offline
Joined: Nov 2003
Posts: 329
I realised my mistake frown

For what ever reason? ( I blame too much coffee )

I had in my head that it was a custom island add in?

Originally Posted by jgeoff

What if I wanted to have both though?
Could it be converted to a custom island?


I was trying to get it as a custom island,
so i could have both, but i was being greedy....

So i'm having problems converting it too a custom island.

Summary..

The code works great smile
I cant suss a second island to run at the same time.

Thanks to JoshPet for a better Top Posters.

p.s Is there anyway to modify out a banned user?


BOOM 7.6.+ rocks....
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yeah, I'm running this on 7.1 sites, no changes.

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Originally Posted by Gizmo
Sorry, it was late when i posted, i was confusing it for another mod; but I haven't heard of this running succuessfully in 7.1 other than ian's forum


Runs fine - no issues - just change the string mentioned and you will be fine smile


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Oct 2006
Posts: 21
Newbie
Newbie
Offline
Joined: Oct 2006
Posts: 21
I've made this work with both Top Posters in Last 30 Days and Top Posters overall. Example of both in play

I've taken Josh's instructions and updated them on how to have BOTH on your forums.

Sorta my first foray off my own back...and it's a bit trickier to do with custom islands because of the way the system forces content creation on the customs. Hopefully this works for you smile

Oh, and this is working on 7.1.1
Attachments
2418-Update_to_TopPostersXDays.txt (3.92 KB, 79 downloads)

Last edited by Carte Blanche; 06/19/2007 9:32 PM.
Joined: Nov 2003
Posts: 482
Enthusiast
Enthusiast
Offline
Joined: Nov 2003
Posts: 482
nice mod

and i love that dark theme you have...

:rawk:

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
The original mod works fine in 7.2 smile

Except as previously mentioned the language file is now in /languages/xxxx/portal_islands.php



Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Sep 2005
Posts: 136
Journeyman
Journeyman
Offline
Joined: Sep 2005
Posts: 136
I attempted this and I got

Parse error: syntax error, unexpected '<' in /home/riddle6/public_html/hprpg/cache_builders/custom/portal_box_7.php on line 2

Joined: Sep 2005
Posts: 136
Journeyman
Journeyman
Offline
Joined: Sep 2005
Posts: 136
Is here anything like 'Top Poster of the Month' out there that could display the top poster of the month instead of a list. Or if I can get this working, can I edit it to do that?

Joined: Jan 2000
Posts: 5,833
Likes: 20
UBBDev / UBBWiki Owner
Time Lord
UBBDev / UBBWiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,833
Likes: 20
Ensure you're pasting content between the EOF lines


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, My UBB Scripts
Joined: Sep 2005
Posts: 136
Journeyman
Journeyman
Offline
Joined: Sep 2005
Posts: 136
Nah Giz, I put it all under the EOF and nothing works, I get a blank white page

Joined: Jan 2000
Posts: 5,833
Likes: 20
UBBDev / UBBWiki Owner
Time Lord
UBBDev / UBBWiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,833
Likes: 20
So it's for sure above the bottom EOF; and under the initial EOF>>> ?


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, My UBB Scripts
Joined: Jan 2000
Posts: 5,833
Likes: 20
UBBDev / UBBWiki Owner
Time Lord
UBBDev / UBBWiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,833
Likes: 20
If so, please post the full code you're using.


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, My UBB Scripts
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
This needs a rewrite for 7.3 - I have tried, but can't quite get it correct frown frown


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Aug 2002
Posts: 32
User
User
Offline
Joined: Aug 2002
Posts: 32
Originally Posted by Gizmo
So it's for sure above the bottom EOF; and under the initial EOF>>> ?

Got a blank page at first, then noticed that the island was built just not shown...
- - - -
$body = <<
EOF;
- - - -

Note! Carte Blanches instructions might have an error as in the above text it was first called top_post_30.php, had to change to top_posters_30.php as that was my filename at least!


Organizer
Joined: Aug 2002
Posts: 32
User
User
Offline
Joined: Aug 2002
Posts: 32
I got another issue with 7.2.2 and the verison from Carte Blanches, the style in the box screws up, if cut and paste as below the backgroun goes black and my default backgroun on all other boxes are white... if I leave more of the original code it end up being either double heading or leave a bit less and I get a box in a box (in both cases then with right styles though)...

Any idea? (code below)

{$tbopen}
{section name=user loop=$users}
{$users[user].posts}

{$users[user].name}


{/section}
{$tbclose}


Organizer
Joined: Nov 2003
Posts: 329
Beta Tester
Beta Tester
Offline
Joined: Nov 2003
Posts: 329
Originally Posted by Ian_W
This needs a rewrite for 7.3 - I have tried, but can't quite get it correct frown frown
My members need to know whos spamming over 30 days.

If this can be sorted for 7.3 it would make alot of my
members very happy.

Still amazed this is not stock.
The best Top Posters ive seen.


BOOM 7.6.+ rocks....
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Indeed - I did try for several hours - got almost there, but the output was in the wrong format/order LOL


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Oct 2006
Posts: 21
Newbie
Newbie
Offline
Joined: Oct 2006
Posts: 21
There may be issues with my tweaks, as I said, it was my first foray into it, and actually, I've turned off the standard and custom islands showing posters.

I do recall I had to do some tweaking to get it to look just right, and stated, it was working in 7.1.1 but I didn't try it out with 7.2.2 and I have no idea how it'll play with 7.3

If I recall, I essentially took the original top posters embedded stuff, created the same thing and tweaked it according to Josh's or someone else's script and named it slight differently so that the original function still existed and my altered one could too. But, heck, that's been some time ago and my brain being all mushy at the moment....bleh.

Joined: Nov 2003
Posts: 329
Beta Tester
Beta Tester
Offline
Joined: Nov 2003
Posts: 329
Originally Posted by Ian_W
Indeed - I did try for several hours - got almost there, but the output was in the wrong format/order LOL
Huge thanks wink

You've had a month since the last try.
< tease > You don't quit that easily normally lol

This should be stock smile
Members love the fact is dynamic and changes.


BOOM 7.6.+ rocks....
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Still no joy frown

Sorry about that - would love to have this running in 7.3


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Apr 2007
Posts: 42
User
User
Offline
Joined: Apr 2007
Posts: 42
Does it not work in 7.3?

Joined: Nov 2003
Posts: 482
Enthusiast
Enthusiast
Offline
Joined: Nov 2003
Posts: 482
7.3-ized version below:

PHP Code

<?php
// Number of days - Top Posters in X days - Edit as needed
$days = 1;

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 p,
{$config['TABLE_PREFIX']}USERS u,
{$config['TABLE_PREFIX']}USER_PROFILE 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++;
}

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

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

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

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

?>


/cache_builders/top_posters.php

set $days to the number of days you want and *poof*

this also colorizes the username to be consistent..

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Thanks SD, works well thumbsup

Open for suggestions on a shorter title smile


- Allen wavey
- What Drives You?
Joined: Apr 2007
Posts: 42
User
User
Offline
Joined: Apr 2007
Posts: 42
Does it look like what is in the top right on this forum?

Looks good.

So what exactly do I need to do with the above code for 7.3? Is that a new island and exactly what do I need to put in the box? Would be a big help!

thank you

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
You take sd's code and put it in place of the code in the /cache_builders/top_posters.php file. Upload it and edit the post islands language file if you want to change the title.


- Allen wavey
- What Drives You?
Joined: Apr 2007
Posts: 42
User
User
Offline
Joined: Apr 2007
Posts: 42
It works!

Great.

Can I ask - how often is this data refreshed?

Thank you.

Joined: Oct 2006
Posts: 21
Newbie
Newbie
Offline
Joined: Oct 2006
Posts: 21
I think you set that in your config for islands by saying how long it should be cached for.

Joined: Oct 2006
Posts: 21
Newbie
Newbie
Offline
Joined: Oct 2006
Posts: 21
Also, the only problem I have with this is that this forces you to replace the top posters with top posters over the last x days.

As stated previously, I was getting too many people trying to push their epeens on post counts over the long haul that I disabled both of my islands showing top posters overall and top posters over last 30 days, but I think I may bring back just the X days variant because of it's dynamic non accruing nature. I'll see if I can't get it working again in a custom island instead of having it overwriting the original top posters one.

Btw, just as a matter of principles too, I've also disabled showing post counts on my forums because of the idiotic nature of some just trying to push post counts higher with "+1" etc.

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.

Page 1 of 2 1 2

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
JAISP
JAISP
PA
Posts: 449
Joined: February 2008
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
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,833
Greg Hard 4,625
Top Posters(30 Days)
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-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)