Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: TOP komentatoriai

Parašė BloodKiller· 2007 Gru. 20 22:12:10
#1

Panele, kuri isrikiuoja narius pagal parasytu komentaru skaiciu mazejancia tvarka.

$limit = 10;

openside("TOP komentatoriai");
$result = dbquery("
   SELECT * FROM ".$db_prefix."comments
   LEFT JOIN ".$db_prefix."users ON user_id = comment_name
   GROUP BY comment_name ORDER BY COUNT(comment_name)
   DESC LIMIT $limit
");

echo "<table width='100%'>
<tr><td><b>Nario vardas</b></td><td><b>Komentarų</b></td><td><b>Vieta</b></td></tr>\n";
while ($data = dbarray($result)) {
   $last = dbarray(dbquery("
      SELECT * FROM ".$db_prefix."comments
      WHERE comment_name = '".$data['user_id']."'
      ORDER BY comment_datestamp
      DESC LIMIT 1
   "));

   switch ($last['comment_type']) {
      case "A" : $title = "Straipsniai"; $link = "readarticle.php?article_id=".$last['comment_item_id']; break;
      case "N" : $title = "Naujienos"; $link = "news.php?readmore=".$last['comment_item_id']; break;
      case "P" : $title = "Nuotraukų galerija"; $link = "photogallery.php?photo_id=".$last['comment_item_id']; break;
      case "U" : $title = "Narių komentavimas"; $link = "profile.php?lookup=".$last['comment_item_id']; break;
      default : $link = ''; break;
   }

   echo "<tr><td><a href='".BASEDIR."profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a></td><td>".dbcount("(*)","comments","comment_name = '".$data['user_id']."'")."</td><td>".($link != "" ? "<center><a href='".BASEDIR.$link."#komentaras_".$last['comment_id']."'>$title</a></center>" : "Nuorodos nėra")."</td></tr>\n";
}
echo "</table>\n";

closeside();



Redagavo BloodKiller· 2007 Gru. 20 22:12:20

Parašė bruzgis· 2007 Gru. 20 22:12:14
#2

saunu, tik tokius dalykus galetum i scriptu biblioteka det

Parašė DvB· 2007 Gru. 20 22:12:49
#3

Šaunuolis ;)