Topcommenters

Download plugins, language packs and stuff.

Topcommenters

Postby FI-DD » Mon Dec 04, 2006 9:28 pm

This hack either shows a list of commenters ordered by the number of comments made in a certain month (list).

Month and year can be selected with the help of dropdowns.



Or it simply shows the top commenter of a certain month (top).



Installation:

1. Copy topcommenters.php to your main CuteNews.RU directory.

2. Put this where you want to show the list:

<? $topstyle = 'list'; include('path_to/topcommenters.php'); ?>



3. Put this where you want to show the top commenter:

<? $topstyle = 'top'; $topmonth = 12; $topyear = 2006; include('path_to/topcommenters.php'); ?>



For example, use this to show the top commenter of the current month:

<? $topstyle = 'top'; $topmonth = date('m'); $topyear = date('Y'); include('path_to/topcommenters.php'); ?>
Attachments
topcommenters.zip
Topcommenters
(1 KiB) Downloaded 384 times
Last edited by FI-DD on Tue Dec 05, 2006 1:19 am, edited 2 times in total.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby scottdallas » Mon Dec 04, 2006 11:16 pm

Oh this is niceeeeee FI-DD you're the man.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby FI-DD » Mon Dec 04, 2006 11:38 pm

Modified it a little bit to make it show the single top commenter instead of the list.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby Saszoo » Mon Dec 04, 2006 11:40 pm

Genious, really this is :)

Just what I've wanted :D

Hm... I discovered that I get some errors with this, it seems it got some problems with enable/disable comments and custom quick tags plugins.

Cannot redeclare cqt_variables. Did you guys get any errors like this?

TIA
User avatar
Saszoo
 
Posts: 414
Joined: Wed Jun 07, 2006 10:34 pm
Location: Norway

Postby astrostart » Tue Feb 20, 2007 9:26 pm

Can I make a request?



Now it shows the 'author' name of the users.



However, in Cutenews they can register a username (author) and a nickname for on the site.



Can it show the nicknames of the users and not the usernames?
My site: http://www.astrostart.nl | Thanks to everyone here who has helped me!
User avatar
astrostart
 
Posts: 124
Joined: Sun Feb 11, 2007 6:08 pm
Location: The Netherlands

Postby asson » Tue Feb 20, 2007 10:31 pm

Thanks FI-DD ;)
asson
 
Posts: 46
Joined: Fri Nov 24, 2006 2:15 am
Location: Karlstad, Sweden

Postby FI-DD » Tue Feb 20, 2007 10:46 pm

astrostart wrote:Now it shows the 'author' name of the users.


It shows what the users put in the name field when leaving a comment, doesn't it?

If they put in their nickname it shows the nickname, if they put in their username it shows the username.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby astrostart » Tue Feb 20, 2007 11:17 pm

You're right, but I have the loginbox hack on my site. So visitors don't have to fill in there name everytime they make a comment.



They just have to register themself with a:

- Username (a name to log in)

- Password

- Nickname (the nickname)

- E-mail



With the username & password the users log in, but if they leave a comment (when logged in), the nickname appears next to it.
My site: http://www.astrostart.nl | Thanks to everyone here who has helped me!
User avatar
astrostart
 
Posts: 124
Joined: Sun Feb 11, 2007 6:08 pm
Location: The Netherlands

Postby FI-DD » Tue Feb 20, 2007 11:28 pm

1. Open topcommenters.php and add this at the end of the file:

Code: Select all
function get_nick_by_author($author){

global $sql;



   $query = reset($sql->select(array('table' => 'users', 'where' => array("username = ".$author))));

   

   return $query['name'];



}




2. Change this:

Code: Select all
echo $author.': '.$comments.'<br />';




to this:

Code: Select all
echo get_nick_by_author($author).': '.$comments.'<br />';




(Not tested.)
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby astrostart » Wed Feb 21, 2007 12:45 am

You're absolutely brilliant! It works!



I have one final request. :oops: I know, I'm annoying.



Could you make something within this plugin that doesn't show the topcommentor of the month, but the five topcommentors of the month?



So instead of this:

User: 49



You get this:

1. User: 49

2. Piet: 48

3. Jan: 13

4. Kees: 10

5. Nop: 9



Is that somehow possible? Can you make something like this with the numbers 1 till 5?



It would be great if you could do this! :D
My site: http://www.astrostart.nl | Thanks to everyone here who has helped me!
User avatar
astrostart
 
Posts: 124
Joined: Sun Feb 11, 2007 6:08 pm
Location: The Netherlands

Postby FI-DD » Wed Feb 21, 2007 7:29 pm

Change this:

Code: Select all
$i = 0;

   foreach($result as $author => $comments){

      if($i == 0){

         echo $author.': '.$comments.'<br />';

      }




to this:

Code: Select all
$i = 1;

   foreach($result as $author => $comments){

      if($i <= 5){

         echo $i.'. '.$author.': '.$comments.'<br />';

      }
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby astrostart » Wed Feb 21, 2007 8:33 pm

OMG! Thank you very much! It works! :D
My site: http://www.astrostart.nl | Thanks to everyone here who has helped me!
User avatar
astrostart
 
Posts: 124
Joined: Sun Feb 11, 2007 6:08 pm
Location: The Netherlands

Postby eberswine » Sat Nov 08, 2008 4:35 pm

Code: Select all
Fatal error: Cannot redeclare cn_calendar() (previously declared in /home/content/r/u/n/site/html/admin/plugins/etc.php:13) in /home/content/r/u/n/site/html/admin/plugins/etc.php on line 12



are there any plugins you need to activate or deactivate for this?
User avatar
eberswine
 
Posts: 289
Joined: Thu Apr 26, 2007 7:23 pm

Postby FI-DD » Thu Nov 13, 2008 7:07 pm

Make sure that you include head.php only once. If you put topcommenters.php into a page which already has head.php included you can remove head.php from topcommenters.php. I hope this makes sense. 8)
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby typeman » Fri Jan 29, 2010 8:19 pm

Anyway to add the user's avatar to it? :)
typeman
 
Posts: 102
Joined: Sat Oct 17, 2009 7:38 am


Return to Additional Downloads



Who is online

Users browsing this forum: No registered users and 0 guests

cron