Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-04-2002, 04:33 AM
TaP TaP is offline
 
Join Date: Nov 2001
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default this should be very simple.....

i got a already made hack that couts the number of theads you started in a certain section... i was wondering if any one could take the code.... and make a top 10 list for it???? it should be very simple i belive

thanks for your time... if you can please post here and i will post the code to work from

Thanks!
Reply With Quote
  #2  
Old 04-04-2002, 05:46 AM
Neo's Avatar
Neo Neo is offline
 
Join Date: Oct 2001
Location: Anywhere
Posts: 1,817
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

top tem list for what
Reply With Quote
  #3  
Old 04-05-2002, 02:21 AM
TaP TaP is offline
 
Join Date: Nov 2001
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

kinda like

Top 10 Posters
Username Posts
joe 8
make 6
john 5
fred 1
stinky 1
jack 0
barney 0
juan 0

but it would be like a top 10 thread for certain forums on the board
Reply With Quote
  #4  
Old 04-05-2002, 03:05 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok I don't know if this will work cuz I don't know a whole lot about php but it's modeled after the Top 5 Hack. If it don't work sorry, I just kinda guessed a bit and my forum is down , but if it doesn't work I would like to see a working one to see what I did wrong. I hope I at least got close.

Find this

$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=number_format($numbersmembers['users']);


Add Under That

// Top 10 Posters in a certain thread
$top10 = $DB_site->query('SELECT userid,username,posts FROM thread WHERE forumid=# ORDER BY posts DESC LIMIT 10');
while ($top10thread = mysql_fetch_array($top10)):
++$top10threadnbsp;
$top10name .= "? <a href=member.php?s=$session[sessionhash]&action=getinfo&userid=$top10thread[userid]>$top10thread[username]</a><br>";
$top10post .= "$top10thread[posts]<br>";
endwhile;
// End Top 10 Posters in a certain thread


Put these on your main page(index.php) somewhere.

$top10thread is the list of users with the most posts
$top10name is there names
$top10post is the amt of posts each user has
Reply With Quote
  #5  
Old 04-05-2002, 04:37 AM
TaP TaP is offline
 
Join Date: Nov 2001
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i get this error

Database error in vBulletin 2.2.4:

Invalid SQL: SELECT userid,username,posts FROM thread WHERE forumid=14 ORDER BY posts DESC LIMIT 10
mysql error: Unknown column 'userid' in 'field list'

mysql error number: 1054
Reply With Quote
  #6  
Old 04-05-2002, 04:45 AM
TaP TaP is offline
 
Join Date: Nov 2001
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok this might help alittle.... all i want is the first hack below working with the second hack

Code:
*********************************
In showthread.php, replace this:
*********************************
$getpostids=$DB_site->query("
	SELECT post.postid FROM post
	WHERE post.threadid='$threadid' AND post.visible=1
	ORDER BY dateline $postorder LIMIT ".($limitlower-1).",$perpage
");

if ($limitupper>$totalposts) {
  $limitupper=$totalposts;
  if ($limitlower>$totalposts) {
    $limitlower=$totalposts-$perpage;
  }
}
if ($limitlower<=0) {
  $limitlower=1;
}
$postids="post.postid IN (0";
while ($post=$DB_site->fetch_array($getpostids)) {
  $postids.=",".$post['postid'];
}

$postids.=")";
*********************************
with this:
*********************************
$getpostids=$DB_site->query("
	SELECT post.postid,post.userid AS postuserid FROM post
	WHERE post.threadid='$threadid' AND post.visible=1
	ORDER BY dateline $postorder LIMIT ".($limitlower-1).",$perpage
");

if ($limitupper>$totalposts) {
  $limitupper=$totalposts;
  if ($limitlower>$totalposts) {
    $limitlower=$totalposts-$perpage;
  }
}
if ($limitlower<=0) {
  $limitlower=1;
}
$postids="post.postid IN (0";
$hackuserids="(0";
while ($post=$DB_site->fetch_array($getpostids)) {
  $postids.=",".$post['postid'];
  $hackuserids.=",".$post['postuserid'];
}
$postids.=")";
$hackuserids.=")";

$hacks=array();
$hackcounts=$DB_site->query("SELECT postuserid,COUNT(*) AS totalhacks FROM thread WHERE forumid IN (x) AND postuserid IN $hackuserids GROUP BY postuserid");
while ($hackcount=$DB_site->fetch_array($hackcounts)) {
  if (!isset($hackcount[totalhacks]))
    $hackcount[totalhacks]=0;
  $hacks["$hackcount[postuserid]"]=$hackcount[totalhacks];
}
$hacks[0]=0;
*********************************

Still in showthread.php, add this:
*********************************
  if ($hacks["$post[userid]"]!='') {
    $post[hacks]="<a href=\"member.php?s=$session[sessionhash]&action=getinfo&userid=$post[userid]\">".$hacks["$post[userid]"]."</a>";
  } else {
    $post[hacks]=0;
  }
*********************************
right after this:
*********************************
while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) {
*********************************

Then use $post[hacks] in the postbit template to show the number of threads the user started in that forum. It will link to the user profile if he has more than 0 threads.



i want that code above to display in this type of form



Code:
<?php

//..........Top X Posters  v0.0.4..........\\
//......by Kevin (kevin@tubescan.com)......\\

// For vBulletin version 2, beta 3
// (c) 2001 Jelsoft Enterprises, Ltd.

// vBulletin.com thread: http://www.vbulletin.com/forum/showt...threadid=12067

///////////// CHANGE LOG /////////////
//
// New in version 0.0.4
// -- Fixed alternating colors so they are horizontal, not vertical
// -- Changed $path to $url and $path2 to $path to make variables easier
// -- Added a seperate header row color
//
// New in version 0.0.3
// -- Added option to exclude admins from list of posters
//
// New in version 0.0.2
// -- Fixed a small bug with the path.
//
// New in version 0.0.1
// -- Released! :)
//
/////////// END CHANGE LOG ///////////

//////// CONFIG EXPLANATION //////////
//
// a] $maxposters > This is the number of posters you want to show.
// b] $hc > The head row color.
// c] $bc1 and $bc2 > These are the first and second alternating color.
// d] $text and $link > Set the colors of the main text and the color of the links. Make sure this color is visible on both alternating colors.
// e] $font > This is the font(s) to use for display. You can set specific fonts (e.g. Verdana, Arial, etc.) or general font-families (e.g. sans-serif, serif).
// f] $fontsize > Set a point size for your font. Size 8 is about equivelant to <font size=1>. Anything below about 6 will basically be undreadable, so be careful.
// g] $url > This is the URL to your board directory. This is not the path to config.php! Do not put a trailing slash, either.
// h] $path > This *is* the path to your config.php file. This should include the /admin part. NO TRAILING SLASH! (May need a leading slash)
// i] $admins > Set this to "1" to show admins on the list of top posters. Set this to "0" to NOT show admins on the list.
//
////// END CONFIG EXPLANATION ////////

/////////////// CONFIG ///////////////
//
$maxposters = "10"; // change this to the number of posters you want to show. for a top 10 listing, set it to 10, etc.
$hc = "#990000"; // change to head row color.
$bc1 = "#777777"; // change to first alternating color.
$bc2 = "#555555"; // change to second alternating color.
$text = "#CCCCCC"; // change to text color.
$link = "#EEEEEE"; // change to link color.
$font = "Verdana,Helvetica,sans-serif"; // change to fonts you want. use serif or sans-serif for general, or use specific fonts names.
$fontsize = "8pt"; // change to font size you want. 8 is about the minimum; go up from there. 1 will not even show up.
$url = "http://www.webserver.org/vb/forums"; // path to your board files. (e.g. index.php, member.php, etc.) may need a starting slash. *do not* put an ending slash on!
$path = "/home/pathforconfig/vb"; // path to your config.php file. may need a starting slash. *do not* put an ending slash on!
$admins = "1"; // change this to "0" to leave admins off the list of top posters.
//
///////////// END CONFIG /////////////

require("$path/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassword) or die("Unable to connect to database");
mysql_select_db($dbname) or die("Unable to select database $dbname");

if ($admins == "1") {
	$exq = mysql_query("SELECT usergroupid FROM usergroup WHERE cancontrolpanel='1'");
	$exr = mysql_result($exq,0,0);
	$exn = "WHERE usergroupid<>$exr";
}

echo("<table border=0 cellpadding=4 cellspacing=0><tr><td align=\"center\" bgcolor=\"$hc\"><b style=\"color: $text; font-family: $font; font-size: $fontsize\"><i>Username</i></b></td><td align=\"center\" bgcolor=\"$hc\"><b style=\"color: $text; font-family: $font; font-size: $fontsize\"><i>Posts</i></b></td></tr>");

$postsresult = mysql_query("SELECT username,posts,userid FROM user $exn ORDER BY posts desc LIMIT 0,$maxposters") or die("Unable to complete query");
while ($topposters = mysql_fetch_array($postsresult)):
	if (($counter++ % 2) != 0) {
		$bc=$bc1;
	} else {
		$bc=$bc2;
	}
	echo("<tr><td align=\"center\" bgcolor=\"$bc\" style=\"color: $text; font-family: $font; font-size: $fontsize\"><a href=\"$url/member.php?&action=getinfo&userid=$topposters[userid]\" style=\"color: $link\">$topposters[username]</a></td><td align=\"center\" bgcolor=\"$bc\" style=\"color: $text; font-family: $font; font-size: $fontsize\">$topposters[posts]</td></tr>");
endwhile;
echo("</table>");

?>
Reply With Quote
  #7  
Old 04-05-2002, 05:06 AM
FWC's Avatar
FWC FWC is offline
 
Join Date: Oct 2001
Location: Ontario, CA
Posts: 821
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by TaP
i get this error


Database error in vBulletin 2.2.4:

Invalid SQL: SELECT userid,username,posts FROM thread WHERE forumid=14 ORDER BY posts DESC LIMIT 10
mysql error: Unknown column 'userid' in 'field list'

mysql error number: 1054
In the thread table the values are postuserid and postusername.
Reply With Quote
  #8  
Old 04-05-2002, 05:30 AM
TaP TaP is offline
 
Join Date: Nov 2001
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i dont understand.???
Reply With Quote
  #9  
Old 04-05-2002, 06:01 AM
FWC's Avatar
FWC FWC is offline
 
Join Date: Oct 2001
Location: Ontario, CA
Posts: 821
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by TaP
i dont understand.???
You need to replace userid and username in that query with postuserid and postusername.
Reply With Quote
  #10  
Old 04-05-2002, 06:37 AM
TaP TaP is offline
 
Join Date: Nov 2001
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

same error..... cant you show a complete peice? im still a bit confused
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:09 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04674 seconds
  • Memory Usage 2,267KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete