View Full Version : Top 10 Points add-on
lifesourcerec
02-08-2003, 07:31 PM
Would be nice to have a Top 10 Points add-on for the points hack.
lifesourcerec
02-12-2003, 03:52 AM
^^ Bumps ^^... How tough would this be?
Zerodark
02-12-2003, 05:09 AM
wouldn't be that tough,..i'll give it a shot for you. i'll let you know later of the progress.
lifesourcerec
02-12-2003, 05:51 AM
Ok. Thanks. Sounds like it would be similar to the other Top 10 hacks.
Erwin
02-12-2003, 08:59 AM
I've done this before many months ago for my forum, but took it out. But you are free to use it.
In index.php, assuming you have installed the Statistic hack -
Find (approximately code that looks like this):
//Top 10 Thread Starters
$toptstarter=$DB_site->query("SELECT COUNT(*) AS count,postuserid,postusername FROM thread WHERE postuserid<>0 GROUP BY postuserid ORDER BY count DESC LIMIT 10");
while ($topt5top = mysql_fetch_array($toptstarter)):
++$topt5topnbsp;
$topt5name .= "<a href=member.php?s=$session[sessionhash]&action=getinfo&userid=$topt5top[postuserid]>$topt5top[postusername]</a><br>";
$topt5post .= "$topt5top[count]<br>";
endwhile;
BELOW, ADD:
//Top 10 Most Points - Erwin
$toppoints = $DB_site->query('
SELECT user.userid, username, fieldXX
FROM user
LEFT JOIN userfield USING (userid)
ORDER BY fieldXX DESC LIMIT 10
');
while ($topb5top = mysql_fetch_array($toppoints)):
++$topb5topnbsp;
$topbname .= "<a href=member.php?s=$session[sessionhash]&action=getinfo&userid=$topb5top[userid]>$topb5top[username]</a><br>";
$topbpost .= "$topb5top[fieldXX]<br>";
endwhile;
Replace the XX in fieldXX (which occurs 3 times) to the profile field id for your points.
Then, in your Top10 statistics template (whatever it is called), add this to the template:
Find:
<TD width="25%" valign="top">
<smallfont>
<b>Top 10 Thread Starters:</b>
<table>
<tr>
<td width=100%><smallfont>User Names:</smallfont></td>
<td align="right"><smallfont>Threads:</smallfont></td>
</tr>
<tr>
<td width=100%><smallfont><b>$topt5name</b></smallfont></td>
<td align="right"><smallfont><b>$topt5post</b></smallfont></td>
</tr>
</table>
</smallfont></td>
BELOW, ADD:
<TD width="25%" valign="top">
<smallfont>
<b>Top 10 Most Points:</b>
<table>
<tr>
<td width=100%><smallfont>User Names:</smallfont></td>
<td align="right"><smallfont>Points:</smallfont></td>
</tr>
<tr>
<td width=100%><smallfont><b>$topbname</b></smallfont></td>
<td align="right"><smallfont><b>$topbpost</b></smallfont></td>
</tr>
</table>
</smallfont></td>
It worked on my site when I used it. :)
lifesourcerec
02-12-2003, 08:07 PM
Thanks Erwin.
$topbname
$topbpost variables doesn't work since I installed Top 10 Thread Stats v1.0 (less templates to worry about). I'll change the variables to the ones I used.
lifesourcerec
02-13-2003, 03:15 AM
It works now, had to remove the spaces between the , and the words. Thanks
Erwin
02-13-2003, 03:54 AM
No problems. :) Glad it works for you.
lifesourcerec
02-13-2003, 03:58 PM
hehe another question :D
How difficult would this be to have them appear on a non-vB page (looking at last 10 posts hack on non-VB page).
lifesourcerec
02-22-2003, 11:33 PM
Originally posted by Erwin
No problems. :) Glad it works for you.
One minor problem. It only does 1 digit, so after 9 points, they disappear from the Top 10 list. Any way of fixing that?
Erwin
02-23-2003, 01:54 AM
That's makes no sense to me... you must have changed something in the code, because that was not how it worked for me.
lifesourcerec
02-23-2003, 03:26 AM
I did a cut and paste. Only thing I changed was the field number which was in your instructions.
Erwin
02-23-2003, 03:42 AM
I can't explain it. Like I said, it was working on my forums.
lifesourcerec
02-23-2003, 11:41 PM
Hmm.. I'll keep playing with it. I removed the Top 10 Statistics and reinstalled it with the same result. After 9 points, the user disappear from the chart.
lifesourcerec
02-24-2003, 12:31 AM
Erwin, I found the problem, but dunno how to fix it. That Top 10 only takes the first number. So, a top 10 would look like that:
member 1 - 9
member 2 - 8
member 3 - 8
member 4 - 7
member 5 - 5
member 6 - 4
member 7 - 2
member 8 - 16
member 9 - 1
member 10 - 1
So it takes the first number as a whole number and treat the numbers behind it as a decimal or something. Is there a way to fix that?
Erwin
02-24-2003, 01:21 AM
Go to your Admin CP, Edit Custom User Profile, and edit that custom profile, making sure you have it set up correctly. My hack does not cut off the length of the numbers, it is something to do with your setup.
lifesourcerec
02-24-2003, 02:26 AM
MaxLength 250. Size 25. So it is definately enough. I have no idea what the problem could be
lifesourcerec
02-25-2003, 06:13 PM
Completely reinstalled with same result.
lifesourcerec
02-28-2003, 03:55 AM
Hehe.. this is frustrating. Looking at the field at it has the right number, but for some reason, the code is only recognizing the first number. I know this should pick up the posts, but it doesn't recognize both numbers
$topbpost .="$topb5top[field11]<br>";
Using the Top 10 hack, not top 5.
Erwin
02-28-2003, 04:21 AM
Maybe it's something to do with the top 10 hack... I really don't know. Get rid of the . in that line of code and see.
sabret00the
02-28-2003, 08:06 AM
what top10 hack are you using?
lifesourcerec
03-01-2003, 04:24 AM
I'm using "Top10 Status v2.2.9+" by NanoEntity.
Removed the "." and it only shows 1 person.
Erwin
03-01-2003, 04:49 AM
That was stupid advice on my part - you need the . to join the variables.
lifesourcerec
03-02-2003, 03:48 AM
It still puzzle me why it only pulls the first number. I checked the database manually and the rights number are there.
lifesourcerec
03-05-2003, 03:13 AM
Erwin, I have an idea. Is there a way to put in a code where it omits 1-9 so that it will start at a minimum of 10. As in no one will list until they get 10 points. That way it will work correctly From 10 through 99.
are you using nano's or erwin's top 10 hack?
lifesourcerec
03-05-2003, 08:53 AM
I'm using "Top10 Status v2.2.9+" by NanoEntity.
Erwin
03-05-2003, 07:57 PM
I've never released a "Top 10 hack". Just to clarify. :)
sonic3d
03-05-2003, 10:33 PM
i have the same problem as lifesourcerec. has ne1 made this work yet?
l8er
sonic
lifesourcerec
03-05-2003, 11:42 PM
Originally posted by sonic3d
i have the same problem as lifesourcerec. has ne1 made this work yet?
l8er
sonic
Glad it's just not me having that problem. :)
so do you have nano's top 10 installed AND erwins top 10 points hack? and is your problem still that it cuts off the 2nd digit?
sonic3d
03-06-2003, 02:26 AM
i have nano's top 10 hack installed. and erwin's top 10 points code. and my problem is it gets cut off at the THIRD digit.
l8er
sonic
well it works fine for me, here is my top 10 code in the index.php
// ################################################## ##########################
// ################# STATISTICS V2 (NanoEntity)?hololith.com ##################
// ################################################## ##########################
$statusexclude = "0"; // What forums should we exclude/hide from INDEX.PHP? EXAMPLE: "1,106,78,910".
$statuslimit = "10"; // What limit should we set for INDEX.PHP?
// ################################ POSTERS ###################################
$hl_posters = $DB_site->query("SELECT userid,username,posts FROM user ORDER BY posts DESC LIMIT $statuslimit");
while ($hl_poster = $DB_site->fetch_array($hl_posters)) {
$hl_postername .= "<a href=\"member.php?s=$session[sessionhash]&action=getinfo&userid=$hl_poster[userid]\" title=\"View profile for $hl_poster[username]\">$hl_poster[username]</a><br>";
$hl_posterposts .= "$hl_poster[posts]<br>";
}
// ################################ /POSTERS ##################################
// ################################ MEMBERS ###################################
$hl_members = $DB_site->query("SELECT userid,posts,username,joindate FROM user ORDER BY joindate DESC LIMIT $statuslimit");
while ($hl_member = $DB_site->fetch_array($hl_members)) {
$hl_membername .= "<a href=\"member.php?s=$session[sessionhash]&action=getinfo&userid=$hl_member[userid]\" title=\"View profile for $hl_member[username]\">$hl_member[username]</a><br>";
$hl_memberposts .= "$hl_member[posts]<br>";
}
// ################################ /MEMBERS ##################################
// ################################ REPLIES ###################################
$hl_replies = $DB_site->query("SELECT thread.replycount,thread.threadid,thread.lastpost, thread.lastposter,thread.views,thread.title,user.u serid FROM thread LEFT JOIN user ON (user.username=thread.lastposter) WHERE forumid NOT IN($statusexclude) ORDER BY lastpost DESC LIMIT $statuslimit");
while ($hl_reply = $DB_site->fetch_array($hl_replies)) {
$hl_replytitle2=unhtmlspecialchars($hl_reply['title']);
$hl_replytitle=iif(strlen($hl_replytitle2)>22,substr($hl_replytitle2,0,17)."..".substr($hl_replytitle2,-10),$hl_replytitle2);
$hl_replythread .= "<i>[$hl_reply[replycount]]</i> <a href=\"showthread.php?s=$session[sessionhash]&threadid=$hl_reply[threadid]\" title=\"$hl_replytitle2\">$hl_replytitle</a><br>";
$hl_replyposter .= "<a href=\"member.php?s=$session[sessionhash]&action=getinfo&userid=$hl_reply[userid]\" title=\"View profile for $hl_reply[lastposter]\">$hl_reply[lastposter]</a><br>";
$hl_replyviews .= "$hl_reply[views]<br>";
}
// ################################ /REPLIES ##################################
//Top 10 Most Points - Erwin
$toppoints = $DB_site->query('
SELECT user.userid, username, field5
FROM user
LEFT JOIN userfield USING (userid)
ORDER BY field5 DESC LIMIT 10
');
while ($topb5top = mysql_fetch_array($toppoints)):
++$topb5topnbsp;
$topbname .= "<a href=member.php?s=$session[sessionhash]&action=getinfo&userid=$topb5top[userid]>$topb5top[username]</a><br>";
$topbpost .= "$topb5top[field5]<br>";
endwhile;
eval("\$hl_top10status = \"".gettemplate("hl_statistics")."\";");
// ################################################## ##########################
// ################# /STATISTICS V2 (NanoEntity)?hololith.com #################
// ################################################## ##########################
try that code out and see if it makes a difference
sonic3d
03-06-2003, 02:52 AM
nope the same, maybe something in the index.php is doing that.
l8er
sonic
try uploading a fresh index.php with this code, see if that helps
sonic3d
03-06-2003, 10:23 PM
nope didn't work.
l8er
sonic
lifesourcerec
03-06-2003, 11:57 PM
Mine still does it after the first number. It may be conflicting with another hack or something.
Erwin
03-07-2003, 12:00 AM
3rd digit and 1st digit? Makes no sense to me. :) There must be something else in index.php or another hack that is conflicting. Try moving the Top 10 code around - move it to the top of index.php - see if that helps.
sonic3d
03-07-2003, 12:13 AM
well mines it in the phpinclude template. i think it conflicting with another hack. oh well. i dont feel like going through all of them.
thanx for helping me out Erwin and Mr. E
l8er
sonic
Erwin
03-07-2003, 02:47 AM
Don't put it in the phpinclude template - it will add a query on EVERY page of vB for no reason.
sonic3d
03-07-2003, 04:05 PM
no it wont cuz i have added this piece of code:
if (strpos($_SERVER['PHP_SELF'], 'index.php') != false)
{
l8er
sonic
Erwin
03-08-2003, 03:19 AM
Ahh... ingenious. :)
lifesourcerec
03-08-2003, 12:51 PM
Originally posted by sonic3d
well mines it in the phpinclude template. i think it conflicting with another hack. oh well. i dont feel like going through all of them.
thanx for helping me out Erwin and Mr. E
l8er
sonic
Can you post your code? I may try putting it in phpinclude. I can deal with it cutting off the 3rd digit. :)
sonic3d
03-08-2003, 09:30 PM
put this code in the phpinclude template.
// STATISTICS V2 (NanoEntity)?hololith.com
if (strpos($_SERVER['PHP_SELF'], 'index.php') != false)
{
$statusexclude = "31"; // What forums should we exclude/hide from INDEX.PHP? EXAMPLE: "1,106,78,910".
$statuslimit = "5"; // What limit should we set for INDEX.PHP?
// POSTERS
$hl_posters = $DB_site->query("SELECT userid,username,posts FROM user ORDER BY posts DESC LIMIT $statuslimit");
while ($hl_poster = $DB_site->fetch_array($hl_posters)) {
$hl_postername .= "<a href=\"member.php?s=$session[sessionhash]&action=getinfo&userid=$hl_poster[userid]\" title=\"View profile for $hl_poster[username]\">$hl_poster[username]</a><br>";
$hl_posterposts .= "$hl_poster[posts]<br>";
}
// /POSTERS
// REPLIES
$hl_replies = $DB_site->query("SELECT thread.replycount,thread.threadid,thread.lastpost, thread.lastposter,thread.views,thread.title,user.u serid FROM thread LEFT JOIN user ON (user.username=thread.lastposter) WHERE forumid NOT IN($statusexclude) ORDER BY lastpost DESC LIMIT $statuslimit");
while ($hl_reply = $DB_site->fetch_array($hl_replies)) {
$hl_replytitle2=unhtmlspecialchars($hl_reply['title']);
$hl_replytitle=iif(strlen($hl_replytitle2)>22,substr($hl_replytitle2,0,17)."..".substr($hl_replytitle2,-10),$hl_replytitle2);
$hl_replythread .= "<i>[$hl_reply[replycount]]</i> <a href=\"showthread.php?s=$session[sessionhash]&threadid=$hl_reply[threadid]\" title=\"$hl_replytitle2\">$hl_replytitle</a><br>";
$hl_replyposter .= "<a href=\"member.php?s=$session[sessionhash]&action=getinfo&userid=$hl_reply[userid]\" title=\"View profile for $hl_reply[lastposter]\">$hl_reply[lastposter]</a><br>";
$hl_replyviews .= "$hl_reply[views]<br>";
}
// /REPLIES
//Top 10 Most Points - Erwin
$toppoints = $DB_site->query('
SELECT user.userid, username, field5
FROM user
LEFT JOIN userfield USING (userid)
ORDER BY field5 DESC LIMIT 5
');
while ($topb5top = mysql_fetch_array($toppoints)):
++$topb5topnbsp;
$topbname .= "<a href=member.php?s=$session[sessionhash]&action=getinfo&userid=$topb5top[userid]>$topb5top[username]</a><br>";
$topbpost .= "$topb5top[field5]<br>";
endwhile;
eval("\$hl_top10status = \"".gettemplate("hl_statistics")."\";");
}
// /STATISTICS V2 (NanoEntity)?hololith.com
i have taken out the members section out of there. u can put it back. i just dont use it.
l8er
sonic
lifesourcerec
03-11-2003, 02:12 AM
Hmm... did it with same result. Oh well, guess I will have to deal with it for now.
lifesourcerec
03-14-2003, 06:32 PM
Just installed a fresh install on a test site and installed the points system and this hack only with the same result (v2.3.0). So it has to be the code.
sonic3d
03-14-2003, 07:54 PM
then can some1 make a whole new code?
l8er
sonic
lifesourcerec
04-05-2003, 05:42 PM
This code is dead :(
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.