View Full Version : top 5 posters
Hi all I'm trying to do the top 5 posters hack like on http://www.extremeforums.com. But have no idea how to do this.
Any help would be greatly apreciated.
JP
it's all in this thread
http://www.vbulletin.com/forum/showthread.php?threadid=2658
thanks but...
Once I have the text below to I just include it in the template in the vb control panel?
cheers
JP
<?php
// Set this to the max number top posters to display
$num = 20;
require("admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM user ORDER BY posts DESC LIMIT $num";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
echo "<FONT SIZE=\"1\" FACE=\"Verdana, Arial, Helvetica, sans-serif\"> °
<A HREF=\"http://animeboards.net/forums/member.php?action=getinfo&userid=$latest_array[userid]\">$latest_array[username]</A></FONT><BR>";
}
save it in a file like top5.php3
and then use an include command into your non vb page
right like this:
1/ save file as top5.php3 in admin folder.
2/ create include (how?) in forumhome template.
3/ end
Is this right?
errhh... the you want the top 5 posters where on your site ?
what i did was only put it on my front index page which is a non vb page.. then i used a php include on my front index.php3 page at http://animeboards.net i saved top5.php3 into my root directory
<?php
include("/home/usr1/www.animeboards.net/htdocs/top5.php3");
?>
oh I want to include it on my forum category page --> forumhome template.
http://216.10.4.112/forums/index.php
Is this easier?
JP
well i don't know anything about php really just code that others here have given me... so that's where my knowledge ends... i haven't tried php code in the forumhome template before ... you can try it though... :)
OK, I'll try - how do I include the file?
JP
PS Thanks for all your help!
that just displays the txt. What should it be surrounded with?
I don't think you can put php into the templates.
but you can try
<?php include("top3.php3") ?>
thanks but doe snot work. any idea what to do now?
I would lovethis feature.
JP
I just posted the include command like you wanted. I assumed you knew to put the opening and closing PHP tags there.
rangersfan had it right, but forgot the semicolon I think...c'mon JP, troubleshoot! :D
<?php include("top5.php3"); ?>
Make sure top5.php3 is in the same directory...if it's not, you'll have to include the relative path.
Well you can open index.php and place this code after require("global.php")
// Set this to the max number top posters to display
$num = 5;
$sql = "SELECT userid,username FROM user ORDER BY posts DESC LIMIT $num";
$results = $DB_site->query($sql);
while ($result = $DB_site->fetch_array($results))
{
$top5 .= "<FONT SIZE=\"1\" FACE=\"Verdana, Arial, Helvetica, sans-serif\"> °
<A HREF=\"member.php?action=getinfo&userid=$result[userid]\">$result[username]</A></FONT><BR>";
}
OR
put this in a file called top5.php
<?php
// Set this to the max number top posters to display
$num = 5;
$sql = "SELECT userid,username FROM user ORDER BY posts DESC LIMIT $num";
$results = $DB_site->query($sql);
while ($result = $DB_site->fetch_array($results))
{
$top5 .= "<FONT SIZE=\"1\" FACE=\"Verdana, Arial, Helvetica, sans-serif\"> °
<A HREF=\"member.php?action=getinfo&userid=$result[userid]\">$result[username]</A></FONT><BR>";
}
?>
and then put require("top5.php"); after require("global.php");
then for either way you put $top5 in your forumhome template where you want the results to show up.
[Edited by rangersfan on 09-13-2000 at 12:58 PM]
TWT nah it would work without the semi-colon if there is only one command.
sorry guys, as i'm sure you've guessed my strength is not coding.
rangersfan, the latter did not work.
is it because of the several double quotes?
Try it now, both ways work for me now.
once again thanks, but not working.
1/ I have top.php in the admin folder
[quote]
<?php
require("global.php");
// Set this to the max number top posters to display
$num = 5;
$sql = "SELECT userid,username FROM user ORDER BY posts DESC LIMIT $num";
$results = $DB_site->query($sql);
while ($result = $DB_site->fetch_array($results))
{
$top5 .= "<FONT SIZE=\"1\" FACE=\"Verdana, Arial, Helvetica, sans-serif\"> °
<A HREF=\"member.php?action=getinfo&userid=$result[userid]\">$result[username]</A></FONT><BR>";
}
?>
[quote]
I also have edited index.php and added $top5 into forumhome template.....help......
JP
Put top5.php in the forums folder, not the admin folder. Remove the require("global.php"); from the top5.php so that it matches what I told you to do.
OK.
top5.php in forums
index.html with require("top5.php"); in forums/admin
$top5 in forumhome
still not workig :(
I tried require("../top5.php"); just in case.
an ideas?
JP
no no no
We are not touching anything in the admin directory, stay out of there!
Edit the index.php in /forums!
i know it is possible but what is the code to show how many posts the user has after his/her name?? tia
i always do this, i post a question and then blam. i figure it out.
$latest_array[posts]
[Edited by poil11 on 09-13-2000 at 09:41 PM]
yes! thanks, I know it took me a while but thanks so much!
one more teeny thing...
I want to clean the actual code up by adding more templates. I added navbar template and then in forumhome template I called $navbar but it did not work. What should I do?
Thanks!
JP
Originally posted by JP Stones
yes! thanks, I know it took me a while but thanks so much!
one more teeny thing...
I want to clean the actual code up by adding more templates. I added navbar template and then in forumhome template I called $navbar but it did not work. What should I do?
Thanks!
JP
check this thread
http://www.vbulletin.com/forum/showthread.php?threadid=2884
hmmm, I thought I was clear on that but oppened global.php and realised i was reading chinese.
I promise I will get better but this is my first venture into php (or anything similar) and I'm hesitant. A quick step by step would be apreciated.
JP
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.