WordPress.org

Plugin Directory

Changeset 430510


Ignore:
Timestamp:
08/30/11 02:57:26 (3 years ago)
Author:
webgrrrl
Message:

Version 1.5 beta

Location:
top-commentators-widget/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • top-commentators-widget/trunk/readme.txt

    r350160 r430510  
    11=== Top Commentators Widget === 
    22Contributors: webgrrrl 
    3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=me%40webgrrrl%2enet&item_name=TCW%20Donation&no_shipping=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8 
    43Tags: comments, widget, seo, sidebar 
    54Requires at least: 2.8 
    6 Tested up to: 3.1 
     5Tested up to: 3.2.1 
    76Stable tag: 1.4.2 
    87 
    9 Adds a sidebar widget to show the top commentators in your WP site. Adapted from Show Top Commentators plugin at Personal Financial Advice. 
     8Adds a sidebar widget to show the top commentators in your WP site. 
    109 
    1110== Description == 
    1211 
    1312The Top Commentators Widget a sidebar widget to show the top commentators in your WP site. Adapted from Show Top Commentators plugin at Personal Financial Advice, this widget is easier to manage via the control form (no need to edit the PHP file); additional options are also available to make it more flexible. Read the FAQ section on how to customize the widget. Read the Changelog as well as http://webgrrrl.net/tags/tcw for the latest news on this widget. 
     13 
     14= For those using the v.0.999a widget in WordPress 2.3.3 or lower = 
     15 
     161. The widget control form may not appear so pretty; the blue control form background does not run to the end of the form. 
     172. Filtering by e-mail does not seem to work in WP 2.3.3 using full or partial address. 
     18 
     19This widget is extensively tested with the following settings: Google Chrome 13.0.782.215 m, PHP 5.2.13, Apache 2.2.15 (Win32), MySQL 5.0.51a, WordPress 3.2.1. Further testing and bug report on this widget is greatly welcomed and appreciated. 
    1420 
    1521== Installation == 
     
    3238 
    3339== Changelog == 
     40 
     41= v.1.5 beta = 
     421. Added Default Blue and Retro to the Gravatar icon options. 
     432. Optimized the query for "Exclude these users" option (presumably could lower database/memory load?). 
     443. Edited the query for commentators' URL (presumably could solve the "same URL for all users" problem that I tried hard to replicate but couldn't?). 
    3445 
    3546= v.1.4.2 = 
     
    74858. Include option to filter users by e-mail. 
    7586 
    76 == Buglist == 
     87== Problem? == 
    7788 
    78 = For those using the v.0.999a widget in WordPress 2.3.3 or lower = 
     89= This widget stopped working after I upgraded. What should I do? = 
    7990 
    80 1. The widget control form may not appear so pretty; the blue control form background does not run to the end of the form. 
    81 2. Filtering by e-mail does not seem to work in WP 2.3.3 using full or partial address. 
     91Go to your Widgets settings and click Save in the Top Commentators widget settings. 
    8292 
    83 This widget is extensively tested with the following settings: Google Chrome 9.0.597.98, PHP 5.3.0, Apache 2.2.12 (Win32), MySQL 5.1.37, WordPress 3.0.5. Further testing and bug report on this widget is greatly welcomed and appreciated. 
     93= The hour / month / year / (whatever period) Reset Period setting doesn't work, not matter how I change it. = 
     94 
     95The widget ALWAYS use the "specify number of days/date" value before the Reset Period dropdown options. Therefore, if you choose to use any of the dropdown options, make sure to leave "specify number of days/date" text box empty. 
     96 
     97= The widget only appears in my homepage and nowhere else. = 
     98 
     99By default, the Top Commentators list will appear only in your homepage (<a href="http://andybeard.eu/609/how-to-show-top-commenters-only-on-your-index-page.html">read this site to find out why it's better</a>). If you want the list to appear site-wide, then set the "Show in home page only?" option to No. 
     100 
     101= No comment/wrong number of comments appeared after I installed/upgraded the Top Commentators widget. = 
     102 
     103Try one or more of the following tips below to solve this: 
     104 
     1051) Go to your Widgets settings and click Save in the Top Commentators Widget settings. 
     1062) Empty the "specify number of days/date" text box. 
     1073) Make sure the Reset Period is set to the period you choose. 
     1084) De-activate, and re-activate the Top Commentators Widget. Then go back to your Widgets settings, remove the Top Commentators from your sidebar, and re-add it again. Then Save the widget settings again. 
     1095) Don't use the Back button of your browser to go back to your Widgets settings. Always reload the Widgets page before changing the settings further. 
    84110 
    85111== Frequently Asked Questions == 
  • top-commentators-widget/trunk/topcommentators_widget.php

    r350160 r430510  
    33Description: Adds a sidebar widget to show the top commentators in your WP site. Adapted from Show Top Commentators plugin.   
    44Author: Lorna Timbah (WebGrrrl.net) 
    5 Version: 1.4.2 
     5Version: 1.5 beta 
    66Author URI: http://webgrrrl.net  
    77Plugin URI: http://webgrrrl.net/archives/my-top-commentators-widget-quick-dirty.htm 
     
    2020    function Topcomm_Widget() { 
    2121        $widget_ops = array( 'classname' => 'topcomm', 'description' => __('Shows the top commentators in your blog.', 'topcomm') ); 
    22         $this->WP_Widget( 'topcomm-widget', __('Top Commentators Widget', 'topcomm'), $widget_ops, $control_ops ); 
     22        $control_ops = null; 
     23    $this->WP_Widget( 'topcomm-widget', __('Top Commentators Widget', 'topcomm'), $widget_ops, $control_ops ); 
    2324    } // end function Topcomm_Widget 
    2425 
     
    2829 
    2930        // variables 
    30         $title = $instance['title']; 
     31        $title = apply_filters('widget_title', $instance['title']); 
    3132        $listDesc = $instance['listDesc']; 
    3233        // start name filter prep 
     
    3435            $excludeNames = trim($instance['excludeNames']); 
    3536            $excludeNames = explode(",", $excludeNames); 
    36             for($i=0; $i<count($excludeNames); $i++) { 
    37                 $new_names .= " AND comment_author NOT IN ('" . trim($excludeNames[$i]) . "')"; 
     37            $countNames = count($excludeNames); 
     38            $new_names = " AND comment_author NOT IN ("; 
     39      for($i=0; $i<$countNames; $i++) { 
     40                $new_names .= "'" . trim($excludeNames[$i]) . "'"; 
     41                if($i != $countNames-1) $new_names .= ","; 
    3842            } 
    39             $excludeNames = $new_names; 
     43            $excludeNames = $new_names . ")"; 
    4044        } // end name filter prep 
    4145        $listPeriod = $instance['listPeriod']; 
     
    8892            $listStart = "<ol>"; 
    8993            $listEnd = "</ol>"; 
    90         } else { 
     94        } elseif($listType == "bul") { 
    9195            $listStart = "<ul>"; 
    9296            $listEnd = "</ul>"; 
     97        } else { 
     98            $listStart = "<div>"; 
     99            $listEnd = "</div>"; 
    93100        } // end list type setup 
    94101        $makeLink = $instance['makeLink']; 
     
    141148      foreach ($commenters as $k) { 
    142149        $url = $wpdb->get_var("SELECT comment_author_url FROM $wpdb->comments 
    143           WHERE comment_author_email = '".addslashes($k->comment_author_email)."' 
     150          WHERE $groupBy = '".addslashes($k->$groupBy)."' 
    144151          AND comment_author_url != 'http://' 
    145152          AND comment_approved = 1 
     
    268275        <label for="<?php echo $this->get_field_id( 'listPeriod' ); ?>">Reset period every:</label>  
    269276        <select id="<?php echo $this->get_field_id( 'listPeriod' ); ?>" name="<?php echo $this->get_field_name( 'listPeriod' ); ?>"> 
    270         <option value="h"<?php if ( 'h' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>Hour</option> 
    271         <option value="d"<?php if ( 'd' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>Day</option> 
    272         <option value="w"<?php if ( 'w' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>Week</option> 
    273         <option value="m"<?php if ( 'm' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>Month</option> 
    274         <option value="y"<?php if ( 'y' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>Year</option> 
    275         <option value="a"<?php if ( 'a' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>List all</option> 
     277        <option value="h"<?php if ( 'h' == $instance['listPeriod'] ) echo ' selected="selected"'; ?>>Hour</option> 
     278        <option value="d"<?php if ( 'd' == $instance['listPeriod'] ) echo ' selected="selected"'; ?>>Day</option> 
     279        <option value="w"<?php if ( 'w' == $instance['listPeriod'] ) echo ' selected="selected"'; ?>>Week</option> 
     280        <option value="m"<?php if ( 'm' == $instance['listPeriod'] ) echo ' selected="selected"'; ?>>Month</option> 
     281        <option value="y"<?php if ( 'y' == $instance['listPeriod'] ) echo ' selected="selected"'; ?>>Year</option> 
     282        <option value="a"<?php if ( 'a' == $instance['listPeriod'] ) echo ' selected="selected"'; ?>>List all</option> 
    276283        </select> 
    277284        <br />Or specify number of days / enter range of date: <input style="width: 100%;" id="<?php echo $this->get_field_id( 'listPeriodnum' ); ?>" name="<?php echo $this->get_field_name( 'listPeriodnum' ); ?>" type="text" value="<?php 
     
    307314        <label for="<?php echo $this->get_field_id( 'listType' ); ?>">Display list as:</label>  
    308315        <select id="<?php echo $this->get_field_id( 'listType' ); ?>" name="<?php echo $this->get_field_name( 'listType' ); ?>"> 
    309         <option value="bul"<?php if ( 'bul' == $instance['listType'] ) echo 'selected="selected"'; ?>>Bulleted</option> 
    310         <option value="num"<?php if ( 'num' == $instance['listType'] ) echo 'selected="selected"'; ?>>Numbered</option> 
     316        <option value="bul"<?php if ( 'bul' == $instance['listType'] ) echo ' selected="selected"'; ?>>Bulleted</option> 
     317        <option value="num"<?php if ( 'num' == $instance['listType'] ) echo ' selected="selected"'; ?>>Numbered</option>    
     318        <option value="div"<?php if ( 'num' == $instance['listType'] ) echo ' selected="selected"'; ?>>DIV</option>    
    311319        </select> 
    312320        </p> 
     
    314322        <label for="<?php echo $this->get_field_id( 'makeLink' ); ?>">Hyperlink each name?</label>  
    315323        <select id="<?php echo $this->get_field_id( 'makeLink' ); ?>" name="<?php echo $this->get_field_name( 'makeLink' ); ?>"> 
    316         <option value="0"<?php if ( '0' == $instance['makeLink'] ) echo 'selected="selected"'; ?>>No</option> 
    317         <option value="1"<?php if ( '1' == $instance['makeLink'] ) echo 'selected="selected"'; ?>>Yes</option> 
     324        <option value="0"<?php if ( '0' == $instance['makeLink'] ) echo ' selected="selected"'; ?>>No</option> 
     325        <option value="1"<?php if ( '1' == $instance['makeLink'] ) echo ' selected="selected"'; ?>>Yes</option> 
    318326        </select> 
    319327        </p> 
     
    321329        <label for="<?php echo $this->get_field_id( 'targetBlank' ); ?>">Open each link in a new window?</label>  
    322330        <select id="<?php echo $this->get_field_id( 'targetBlank' ); ?>" name="<?php echo $this->get_field_name( 'targetBlank' ); ?>"> 
    323         <option value="0"<?php if ( '0' == $instance['targetBlank'] ) echo 'selected="selected"'; ?>>No</option> 
    324         <option value="1"<?php if ( '1' == $instance['targetBlank'] ) echo 'selected="selected"'; ?>>Yes</option> 
     331        <option value="0"<?php if ( '0' == $instance['targetBlank'] ) echo ' selected="selected"'; ?>>No</option> 
     332        <option value="1"<?php if ( '1' == $instance['targetBlank'] ) echo ' selected="selected"'; ?>>Yes</option> 
    325333        </select> 
    326334        </p> 
     
    328336        <label for="<?php echo $this->get_field_id( 'noFollow' ); ?>">NoFollow each name if hyperlinked?</label>  
    329337        <select id="<?php echo $this->get_field_id( 'noFollow' ); ?>" name="<?php echo $this->get_field_name( 'noFollow' ); ?>"> 
    330         <option value="0"<?php if ( '0' == $instance['noFollow'] ) echo 'selected="selected"'; ?>>No</option> 
    331         <option value="1"<?php if ( '1' == $instance['noFollow'] ) echo 'selected="selected"'; ?>>Yes</option> 
     338        <option value="0"<?php if ( '0' == $instance['noFollow'] ) echo ' selected="selected"'; ?>>No</option> 
     339        <option value="1"<?php if ( '1' == $instance['noFollow'] ) echo ' selected="selected"'; ?>>Yes</option> 
    332340        </select> 
    333341        </p> 
     
    335343        <label for="<?php echo $this->get_field_id( 'showCount' ); ?>">Show number of comments for each commenter?</label>  
    336344        <select id="<?php echo $this->get_field_id( 'showCount' ); ?>" name="<?php echo $this->get_field_name( 'showCount' ); ?>"> 
    337         <option value="0"<?php if ( '0' == $instance['showCount'] ) echo 'selected="selected"'; ?>>No</option> 
    338         <option value="1"<?php if ( '1' == $instance['showCount'] ) echo 'selected="selected"'; ?>>Yes</option> 
     345        <option value="0"<?php if ( '0' == $instance['showCount'] ) echo ' selected="selected"'; ?>>No</option> 
     346        <option value="1"<?php if ( '1' == $instance['showCount'] ) echo ' selected="selected"'; ?>>Yes</option> 
    339347        </select> 
    340348        </p> 
     
    342350        <label for="<?php echo $this->get_field_id( 'groupBy' ); ?>">(Hijack-proof?) Group commentors based on:</label>  
    343351        <select id="<?php echo $this->get_field_id( 'groupBy' ); ?>" name="<?php echo $this->get_field_name( 'groupBy' ); ?>"> 
    344         <option value="0"<?php if ( '0' == $instance['groupBy'] ) echo 'selected="selected"'; ?>>E-mail</option> 
    345         <option value="1"<?php if ( '1' == $instance['groupBy'] ) echo 'selected="selected"'; ?>>User name</option> 
     352        <option value="0"<?php if ( '0' == $instance['groupBy'] ) echo ' selected="selected"'; ?>>E-mail</option> 
     353        <option value="1"<?php if ( '1' == $instance['groupBy'] ) echo ' selected="selected"'; ?>>User name</option> 
    346354        </select> 
    347355        </p> 
     
    349357        <label for="<?php echo $this->get_field_id( 'showInHome' ); ?>">Show in home page only?</label>  
    350358        <select id="<?php echo $this->get_field_id( 'showInHome' ); ?>" name="<?php echo $this->get_field_name( 'showInHome' ); ?>"> 
    351         <option value="0"<?php if ( '0' == $instance['showInHome'] ) echo 'selected="selected"'; ?>>No</option> 
    352         <option value="1"<?php if ( '1' == $instance['showInHome'] ) echo 'selected="selected"'; ?>>Yes</option> 
     359        <option value="0"<?php if ( '0' == $instance['showInHome'] ) echo ' selected="selected"'; ?>>No</option> 
     360        <option value="1"<?php if ( '1' == $instance['showInHome'] ) echo ' selected="selected"'; ?>>Yes</option> 
    353361        </select> 
    354362        </p> 
     
    356364        <label for="<?php echo $this->get_field_id( 'onlyWithUrl' ); ?>">Display only commentors with URL?</label>  
    357365        <select id="<?php echo $this->get_field_id( 'onlyWithUrl' ); ?>" name="<?php echo $this->get_field_name( 'onlyWithUrl' ); ?>"> 
    358         <option value="0"<?php if ( '0' == $instance['onlyWithUrl'] ) echo 'selected="selected"'; ?>>No</option> 
    359         <option value="1"<?php if ( '1' == $instance['onlyWithUrl'] ) echo 'selected="selected"'; ?>>Yes</option> 
     366        <option value="0"<?php if ( '0' == $instance['onlyWithUrl'] ) echo ' selected="selected"'; ?>>No</option> 
     367        <option value="1"<?php if ( '1' == $instance['onlyWithUrl'] ) echo ' selected="selected"'; ?>>Yes</option> 
    360368        </select> 
    361369        </p> 
     
    363371        <label for="<?php echo $this->get_field_id( 'displayGravatar' ); ?>">Display Gravatar?</label>  
    364372        <select id="<?php echo $this->get_field_id( 'displayGravatar' ); ?>" name="<?php echo $this->get_field_name( 'displayGravatar' ); ?>"> 
    365         <option value="0"<?php if ( '0' == $instance['displayGravatar'] ) echo 'selected="selected"'; ?>>No</option> 
    366         <option value="1"<?php if ( '1' == $instance['displayGravatar'] ) echo 'selected="selected"'; ?>>Yes</option> 
     373        <option value="0"<?php if ( '0' == $instance['displayGravatar'] ) echo ' selected="selected"'; ?>>No</option> 
     374        <option value="1"<?php if ( '1' == $instance['displayGravatar'] ) echo ' selected="selected"'; ?>>Yes</option> 
    367375        </select> 
    368376        </p> 
    369377        <p> 
    370378        <label for="<?php echo $this->get_field_id( 'defaultGravatar' ); ?>">Use the following default Gravatar:</label>  
    371         <select id="<?php echo $this->get_field_id( 'defaultGravatar' ); ?>" name="<?php echo $this->get_field_name( 'defaultGravatar' ); ?>"> 
    372         <option value="404"<?php if ( '404' == $instance['defaultGravatar'] ) echo 'selected="selected"'; ?>>404</option> 
    373         <option value="mm"<?php if ( 'mm' == $instance['defaultGravatar'] ) echo 'selected="selected"'; ?>>Mystery Man</option> 
    374         <option value="identicon"<?php if ( 'identicon' == $instance['defaultGravatar'] ) echo 'selected="selected"'; ?>>Identicon</option> 
    375         <option value="monsterid"<?php if ( 'monsterid' == $instance['defaultGravatar'] ) echo 'selected="selected"'; ?>>MonsterID</option> 
    376         <option value="wavatar"<?php if ( 'wavatar' == $instance['defaultGravatar'] ) echo 'selected="selected"'; ?>>Wavatar</option> 
     379        <select id="<?php echo $this->get_field_id( 'defaultGravatar' ); ?>" name="<?php echo $this->get_field_name( 'defaultGravatar' ); ?>">     
     380        <option value=""<?php if ( '' == $instance['defaultGravatar'] ) echo ' selected="selected"'; ?>>Default blue</option> 
     381        <option value="404"<?php if ( '404' == $instance['defaultGravatar'] ) echo ' selected="selected"'; ?>>404</option> 
     382        <option value="mm"<?php if ( 'mm' == $instance['defaultGravatar'] ) echo ' selected="selected"'; ?>>Mystery Man</option> 
     383        <option value="identicon"<?php if ( 'identicon' == $instance['defaultGravatar'] ) echo ' selected="selected"'; ?>>Identicon</option> 
     384        <option value="monsterid"<?php if ( 'monsterid' == $instance['defaultGravatar'] ) echo ' selected="selected"'; ?>>MonsterID</option> 
     385        <option value="wavatar"<?php if ( 'wavatar' == $instance['defaultGravatar'] ) echo ' selected="selected"'; ?>>Wavatar</option>                 
     386        <option value="retro"<?php if ( 'retro' == $instance['defaultGravatar'] ) echo ' selected="selected"'; ?>>Retro</option> 
    377387        </select> 
    378388        Size:<input id="<?php echo $this->get_field_id( 'avatarSize' ); ?>" name="<?php echo $this->get_field_name( 'avatarSize' ); ?>" value="<?php echo $instance['avatarSize']; ?>" style="width: 30px;" type="text" /> 
     
    390400        <label for="<?php echo $this->get_field_id( 'alignAward' ); ?>">Align the Award icon:</label>  
    391401        <select id="<?php echo $this->get_field_id( 'alignAward' ); ?>" name="<?php echo $this->get_field_name( 'alignAward' ); ?>"> 
    392         <option value="0"<?php if ( '0' == $instance['alignAward'] ) echo 'selected="selected"'; ?>>Left before Gravatar</option> 
    393         <option value="1"<?php if ( '1' == $instance['alignAward'] ) echo 'selected="selected"'; ?>>Left after Gravatar</option> 
    394         <option value="2"<?php if ( '2' == $instance['alignAward'] ) echo 'selected="selected"'; ?>>Right</option> 
     402        <option value="0"<?php if ( '0' == $instance['alignAward'] ) echo ' selected="selected"'; ?>>Left before Gravatar</option> 
     403        <option value="1"<?php if ( '1' == $instance['alignAward'] ) echo ' selected="selected"'; ?>>Left after Gravatar</option> 
     404        <option value="2"<?php if ( '2' == $instance['alignAward'] ) echo ' selected="selected"'; ?>>Right</option> 
    395405        </select> 
    396406        </p> 
Note: See TracChangeset for help on using the changeset viewer.