TopPosters 1.1 This small two-step mod adds a Top (n) Posters area in the Info Center in Board Index. Number (n) of members in the list are set in BoardIndex.pl near the top before upload. Instructions: Apply mod. Upload BoardIndex.pl in ASCII mode Carsten http://www.langaa-net.dk/cgi-bin/kayabb/YaBB.pl Sources/BoardIndex.pl sub BoardIndex { $high_lst = 5; # Set the number of members in the Top-Poster list $guests $txt{'141'}, $numusers $txt{'142'}
$users
~; $total_posts = 0; foreach $curcat (@categories) { chomp $curcat; fopen(FILE, "$boardsdir/$curcat.cat"); @thiscurcat = ; chomp @thiscurcat; fclose(FILE); foreach $curboard (@thiscurcat) { chomp $curboard; ( $threadcount, $messagecount, $lastposttime, $lastposter ) = &BoardCountGet($curboard); $total_posts += $messagecount; } } my(@templist, @SortAList); fopen(FILE, "$memberdir/memberlist.txt"); @membername = ; $memcount = @membername; fclose(FILE); $z = 0; $total_topposts = 0; for($i=0;$i<$memcount;$i++) { chomp(@membername); $membname = $membername[$i]; fopen(MEMBERFILE,"$memberdir/$membname.dat"); @member = ; fclose(MEMBERFILE); chomp(@member); if($member[6] > 0) { $templist[$z] .= qq($member[6]|$member[1]|$membname); $z++; } } @SortAList = sort{$b<=>$a} (@templist); $pstmem = @SortAList; if($pstmem > $high_lst) { $pstmem = $high_lst } if($pstmem > 0) { $yymain .= qq~ $txt{'411'} $pstmem $txt{'306'}
~; for($i=0;$i<$pstmem;$i++) { $x = $i+1; chomp(@SortAList); ($shposts[$i], $shname[$i], $usname[$i]) = split(/\|/, $SortAList[$i]); $total_topposts = $total_topposts + $shposts[$i]; $Bar = ""; $barchart = ($shposts[$i]); $bartemp = ($shposts[$i] * 100); $barwidth = ($bartemp / $shposts[0]); $barwidth = ($barwidth + 0.5); $barwidth = int($barwidth); if($barwidth > 100) {$barwidth = 100} if ($barwidth < 1) {$Bar = "$Bar";} else { $Bar = qq~~; } if ($Bar eq "") { $Bar=" "; } &LoadUser($usname[$i]); $yymain .= qq~ ~; } if ($total_posts > 0) { $tmp_pct = ($total_topposts * 100) / $total_posts; } else { $tmp_pct = 0; } $top_pct = sprintf ("%.2f", $tmp_pct); $yymain .= qq~
$x. $shname[$i] $shposts[$i] $Bar
$pstmem $txt{'314'}:
- $total_topposts $txt{'86'}
- $top_pct% $txt{'309'} $txt{'190'} $txt{'86'}
~; } $yymain .= qq~