| Author |
Message |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
Topcommenters |
|
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'); ?>
| Description: |
|
 Download |
| Filename: |
topcommenters.zip |
| Filesize: |
1 KB |
| Downloaded: |
224 Time(s) |
Last edited by FI-DD on Tue Dec 05, 2006 1:19 am; edited 2 times in total |
|
| Mon Dec 04, 2006 9:28 pm |
|
 |
Guest
|
|
|
Please login to hide the ads.
|
|
|
|
 |
scottdallas

Joined: 04 May 2006 Posts: 1943 Location: US |
|
|
|
Oh this is niceeeeee FI-DD you're the man.
_________________ www.scottdizzle.com uses cnr
last update: 07-22-08: 8:30 pm |
|
| Mon Dec 04, 2006 11:16 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
Modified it a little bit to make it show the single top commenter instead of the list.
|
|
| Mon Dec 04, 2006 11:38 pm |
|
 |
Saszoo

Joined: 07 Jun 2006 Posts: 410 Location: Norway |
|
|
|
Genious, really this is
Just what I've wanted
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
_________________ My cute.ru site |
|
| Mon Dec 04, 2006 11:40 pm |
|
 |
astrostart

Joined: 11 Feb 2007 Posts: 124 Location: The Netherlands |
|
|
|
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! |
|
| Tue Feb 20, 2007 9:26 pm |
|
 |
asson
Joined: 24 Nov 2006 Posts: 46 Location: Karlstad, Sweden |
|
|
| Tue Feb 20, 2007 10:31 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
 |  | 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.
|
|
| Tue Feb 20, 2007 10:46 pm |
|
 |
astrostart

Joined: 11 Feb 2007 Posts: 124 Location: The Netherlands |
|
|
|
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! |
|
| Tue Feb 20, 2007 11:17 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
1. Open topcommenters.php and add this at the end of the file:
 |  | 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:
 |  | echo $author.': '.$comments.'<br />'; |
to this:
 |  | echo get_nick_by_author($author).': '.$comments.'<br />'; |
(Not tested.)
|
|
| Tue Feb 20, 2007 11:28 pm |
|
 |
astrostart

Joined: 11 Feb 2007 Posts: 124 Location: The Netherlands |
|
|
|
You're absolutely brilliant! It works!
I have one final request. 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! 
_________________ My site: http://www.astrostart.nl | Thanks to everyone here who has helped me! |
|
| Wed Feb 21, 2007 12:45 am |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
Change this:
 |  | $i = 0;
foreach($result as $author => $comments){
if($i == 0){
echo $author.': '.$comments.'<br />';
} |
to this:
 |  | $i = 1;
foreach($result as $author => $comments){
if($i <= 5){
echo $i.'. '.$author.': '.$comments.'<br />';
} |
|
|
| Wed Feb 21, 2007 7:29 pm |
|
 |
astrostart

Joined: 11 Feb 2007 Posts: 124 Location: The Netherlands |
|
|
|
OMG! Thank you very much! It works! 
_________________ My site: http://www.astrostart.nl | Thanks to everyone here who has helped me! |
|
| Wed Feb 21, 2007 8:33 pm |
|
 |
eberswine

Joined: 26 Apr 2007 Posts: 148
|
|
|
|
 |  | 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?
|
|
| Sat Nov 08, 2008 4:35 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
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. 
|
|
| Thu Nov 13, 2008 7:07 pm |
|
 |
|