php forum
php mysql forum
php mysql smarty
 
Page 2 of 3 < 1 2 3 >
Topic Options
#315968 - 10/07/07 12:29 AM Re: [7.0.x] Top Posters in Last X Days [Re: Gizmo]
AshtarRose Offline
Journeyman

Registered: 09/22/05
Posts: 134
Loc: Orlando, FL
Nah Giz, I put it all under the EOF and nothing works, I get a blank white page
_________________________
http://www.riddledindarkness.com * Yeah I need the Crazy Mods.

Top
#315972 - 10/07/07 09:16 AM Re: [7.0.x] Top Posters in Last X Days [Re: AshtarRose]
Gizmo Administrator Offline
Wizard

Registered: 01/10/00
Posts: 5131
Loc: Portland, OR, USA
So it's for sure above the bottom EOF; and under the initial EOF>>> ?
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design Owner

Top
#315973 - 10/07/07 09:17 AM Re: [7.0.x] Top Posters in Last X Days [Re: Gizmo]
Gizmo Administrator Offline
Wizard

Registered: 01/10/00
Posts: 5131
Loc: Portland, OR, USA
If so, please post the full code you're using.
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design Owner

Top
#316542 - 12/31/07 11:38 AM Re: [7.0.x] Top Posters in Last X Days [Re: Gizmo]
Ian_W Global Moderator Offline
Veteran

Registered: 02/22/02
Posts: 2575
Loc: England
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....)

Top
#316668 - 01/29/08 08:05 AM Re: [7.0.x] Top Posters in Last X Days [Re: Ian_W]
Organizer Offline
User

Registered: 08/17/02
Posts: 34
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
<?php include("{$config['FULL_PATH']}/cache/top_posters_30.php") ?>
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

Top
#316669 - 01/29/08 08:22 AM Re: [7.0.x] Top Posters in Last X Days [Re: Organizer]
Organizer Offline
User

Registered: 08/17/02
Posts: 34
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}
<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}
_________________________
Organizer

Top
#316732 - 02/19/08 02:37 PM Re: [7.0.x] Top Posters in Last X Days [Re: Ian_W]
Mark_S Offline
Power User

Registered: 11/15/03
Posts: 85
Loc: UK
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.

Top
#316745 - 02/21/08 06:08 AM Re: [7.0.x] Top Posters in Last X Days [Re: Mark_S]
Ian_W Global Moderator Offline
Veteran

Registered: 02/22/02
Posts: 2575
Loc: England
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....)

Top
#316761 - 02/28/08 05:15 AM Re: [7.0.x] Top Posters in Last X Days [Re: Ian_W]
Carte Blanche Offline
Newbie

Registered: 10/08/06
Posts: 19
Loc: Auckland, NZ
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.

Top
#316815 - 03/26/08 03:34 PM Re: [7.0.x] Top Posters in Last X Days [Re: Ian_W]
Mark_S Offline
Power User

Registered: 11/15/03
Posts: 85
Loc: UK
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.

Top
#316823 - 03/28/08 03:21 AM Re: [7.0.x] Top Posters in Last X Days [Re: Mark_S]
Ian_W Global Moderator Offline
Veteran

Registered: 02/22/02
Posts: 2575
Loc: England
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....)

Top
#317078 - 05/28/08 06:59 AM Re: [7.0.x] Top Posters in Last X Days [Re: Ian_W]
willing Offline
User

Registered: 04/17/07
Posts: 42
Does it not work in 7.3?

Top
#317080 - 05/28/08 10:55 AM Re: [7.0.x] Top Posters in Last X Days [Re: willing]
sirdude Moderator Offline
Enthusiast

Registered: 11/08/03
Posts: 441
Loc: SoCal
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..
_________________________

Top
#317097 - 05/29/08 10:00 PM Re: [7.0.x] Top Posters in Last X Days [Re: sirdude]
AllenAyres Administrator Offline
I type Like navaho

Registered: 03/10/00
Posts: 25448
Loc: Texas
Thanks SD, works well thumbsup

Open for suggestions on a shorter title smile
_________________________
- Allen wavey
- What Drives You?

Top
#317104 - 05/30/08 08:43 PM Re: [7.0.x] Top Posters in Last X Days [Re: AllenAyres]
willing Offline
User

Registered: 04/17/07
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

Top
#317106 - 05/30/08 09:42 PM Re: [7.0.x] Top Posters in Last X Days [Re: willing]
AllenAyres Administrator Offline
I type Like navaho

Registered: 03/10/00
Posts: 25448
Loc: Texas
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?

Top
#317107 - 05/30/08 10:05 PM Re: [7.0.x] Top Posters in Last X Days [Re: AllenAyres]
willing Offline
User

Registered: 04/17/07
Posts: 42
It works!

Great.

Can I ask - how often is this data refreshed?

Thank you.

Top
#317110 - 05/31/08 03:58 AM Re: [7.0.x] Top Posters in Last X Days [Re: willing]
Carte Blanche Offline
Newbie

Registered: 10/08/06
Posts: 19
Loc: Auckland, NZ
I think you set that in your config for islands by saying how long it should be cached for.

Top
#317111 - 05/31/08 04:04 AM Re: [7.0.x] Top Posters in Last X Days [Re: Carte Blanche]
Carte Blanche Offline
Newbie

Registered: 10/08/06
Posts: 19
Loc: Auckland, NZ
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.

Top
#317113 - 05/31/08 05:33 AM Re: [7.0.x] Top Posters in Last X Days [Re: Carte Blanche]
Carte Blanche Offline
Newbie

Registered: 10/08/06
Posts: 19
Loc: Auckland, NZ
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&amp;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.

Top
Page 2 of 3 < 1 2 3 >


Moderator:  sirdude 
Who's Online
0 registered (), 26 Guests and 15 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Forum 'Trader Ratings'.
by blaaskaak
Yesterday at 08:27 AM
Problems reading a lot of old posts here
by Ruben Rocha
11/18/08 04:33 PM
PhotoPost BB Code Popup
by Iann128
11/15/08 01:24 PM
Customization needed
by Gizmo
11/12/08 12:28 PM
Team UBBDev Rides Again!
by AllenAyres
11/11/08 02:16 PM
Active Topics.
by AllenAyres
11/11/08 02:13 PM
Looking for a simple upload script
by AllenAyres
11/11/08 02:12 PM
New Mods
Forum 'Trader Ratings'.
by McLemore
11/19/08 02:14 PM
[7.4] Keep log of custom title changes
by blaaskaak
10/27/08 07:51 AM
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Newest Members
Begbie, cenk, MATTO, DougMMcts, tim Anderson
13361 Registered Users
Top Posters
AllenAyres 25448
JoshPet<