WordPress.org

Plugin Directory

Changeset 1819435


Ignore:
Timestamp:
02/09/18 22:59:16 (9 days ago)
Author:
coffee2code
Message:

Release v1.9:

  • Bugfix: Explicitly set comment count font color to avoid style conflict with Akismet that resulted in gray text on dark gray background
  • Bugfix: Disable Akismet's version of the functionality since it is duplicative and interferes with author section layout
  • Change: Omit unnecessary wp_register_style() and instead provide all arguments to wp_enqueue_style()
  • Harden: Use 'esc_like()` on the pingback/trackback URL prior to use in queries
  • Bugfix: Use proper existing variable when searching for other pingbacks/trackbacks
  • Change: Omit unnecessary appending of '%' to author_url value in call to get_comments_count()
  • New: Add README.md
  • Change: Add GitHub link to readme
  • Change: Note compatibility through WP 4.9+
  • Change: Update copyright date (2018)
  • Change: Minor whitespace tweaks in unit test bootstrap
Location:
admin-commenters-comments-count
Files:
2 added
5 edited
7 copied

Legend:

Unmodified
Added
Removed
  • admin-commenters-comments-count/tags/1.9/admin-commenters-comments-count.php

    r1611510 r1819435  
    22/** 
    33 * Plugin Name: Admin Commenters Comments Count 
    4  * Version:     1.8 
     4 * Version:     1.9 
    55 * Plugin URI:  http://coffee2code.com/wp-plugins/admin-commenters-comments-count/ 
    66 * Author:      Scott Reilly 
     
    1111 * Description: Displays a count of each commenter's total number of comments (linked to those comments) next to their name on any admin page. 
    1212 * 
    13  * Compatible with WordPress 4.6 through 4.7+. 
     13 * Compatible with WordPress 4.6 through 4.9+. 
    1414 * 
    1515 * =>> Read the accompanying readme.txt file for instructions and documentation. 
     
    1919 * @package Admin_Commenters_Comments_Count 
    2020 * @author  Scott Reilly 
    21  * @version 1.8 
     21 * @version 1.9 
    2222 */ 
    2323 
     
    3030 *   email addresses in the group. Via filter maybe? 
    3131 * - Add sortability to 'Comments' column in user table 
     32 * - Consider inserting commenter bomment bubble via 'comment_row_actions' hook like Akismet does, though that 
     33 *   requires introducing a JS dependency. 
    3234 * 
    3335 */ 
    3436 
    3537/* 
    36     Copyright (c) 2009-2017 by Scott Reilly (aka coffee2code) 
     38    Copyright (c) 2009-2018 by Scott Reilly (aka coffee2code) 
    3739 
    3840    This program is free software; you can redistribute it and/or 
     
    105107     */ 
    106108    public static function version() { 
    107         return '1.8'; 
     109        return '1.9'; 
    108110    } 
    109111 
     
    131133        add_filter( 'manage_users_columns',       array( __CLASS__, 'add_user_column'         )        ); 
    132134        add_filter( 'manage_users_custom_column', array( __CLASS__, 'handle_column_data'      ), 10, 3 ); 
     135 
     136        // Disable Akismet's version of this functionality. 
     137        add_filter( 'akismet_show_user_comments_approved', '__return_false' ); 
    133138    } 
    134139 
     
    148153     */ 
    149154    public static function enqueue_admin_css() { 
    150         wp_register_style( __CLASS__ . '_admin', plugins_url( 'assets/admin.css', __FILE__ ) ); 
    151         wp_enqueue_style( __CLASS__ . '_admin', false, array(), self::version() ); 
     155        wp_enqueue_style( __CLASS__ . '_admin', plugins_url( 'assets/admin.css', __FILE__ ), array(), self::version() ); 
    152156    } 
    153157 
     
    226230        } elseif ( 'pingback' == $type || 'trackback' == $type ) { 
    227231            $query = "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_author_url LIKE %s AND comment_type = %s AND comment_approved = %d"; 
    228             $comment_count = $wpdb->get_var( $wpdb->prepare( $query, $author_url.'%', $type, 1 ) ); 
    229             $pending_count = $wpdb->get_var( $wpdb->prepare( $query, $author_url.'%', $type, 0 ) ); 
     232            $comment_count = $wpdb->get_var( $wpdb->prepare( $query, $wpdb->esc_like( $value ) . '%', $type, 1 ) ); 
     233            $pending_count = $wpdb->get_var( $wpdb->prepare( $query, $wpdb->esc_like( $value ) . '%', $type, 0 ) ); 
    230234        } else { 
    231235            $comment_count = $pending_count = 0; 
     
    293297            $parsed_url = parse_url( $author_url ); 
    294298            $author_url = $parsed_url['scheme'] . '://' . $parsed_url['host']; 
    295             list( $comment_count, $pending_count ) = self::get_comments_count( 'comment_author_url', $author_url . '%', $type ); 
     299            list( $comment_count, $pending_count ) = self::get_comments_count( 'comment_author_url', $author_url, $type ); 
    296300            $author_email = $author_url; 
    297301            /* Translators: sorry, but I'm not supplying explicit translation strings for all possible other comment types. 
  • admin-commenters-comments-count/tags/1.9/assets/admin.css

    r1611510 r1819435  
    88    margin-right: 21px; 
    99} 
     10 
    1011.column-commenters_count { 
    1112    width: 74px; 
     
    1516    float: none; 
    1617} 
     18 
     19/* Explicitly set font color with a specifity to override a too-broadly applied style (by Akismet). */ 
     20#the-comment-list .author .author-com-count a span { 
     21    color: #fff; 
     22} 
     23 
    1724@media screen and (max-width: 782px) { 
    1825    .wp-list-table.users .author-com-count { 
  • admin-commenters-comments-count/tags/1.9/readme.txt

    r1611510 r1819435  
    66License URI: http://www.gnu.org/licenses/gpl-2.0.html 
    77Requires at least: 4.6 
    8 Tested up to: 4.7 
    9 Stable tag: 1.8 
     8Tested up to: 4.9 
     9Stable tag: 1.9 
    1010 
    1111Displays a count of each commenter's total number of comments (linked to those comments) next to their name on any admin page. 
     
    3535Commenters are identified by the email address they provided when commenting. If your site does not require that commenters submit their email address when commenting, this plugin will use the commenter's name as the identifier, though since this is a publicly viewable piece of data it's possible that multiple people could be posting under the same "name", so this method has the potential to be not as accurate. 
    3636 
    37 Links: [Plugin Homepage](http://coffee2code.com/wp-plugins/admin-commenters-comments-count/) | [Plugin Directory Page](https://wordpress.org/plugins/admin-commenters-comments-count/) | [Author Homepage](http://coffee2code.com) 
     37Links: [Plugin Homepage](http://coffee2code.com/wp-plugins/admin-commenters-comments-count/) | [Plugin Directory Page](https://wordpress.org/plugins/admin-commenters-comments-count/) | [GitHub](https://github.com/coffe2code/admin-commenters-comments-count/) | [Author Homepage](http://coffee2code.com) 
    3838 
    3939 
     
    8282 
    8383== Changelog == 
     84 
     85= 1.9 (2017-11-06) = 
     86* Bugfix: Explicitly set comment count font color to avoid style conflict with Akismet that resulted in gray text on dark gray background 
     87* Bugfix: Disable Akismet's version of the functionality since it is duplicative and interferes with author section layout 
     88* Change: Omit unnecessary `wp_register_style()` and instead provide all arguments to `wp_enqueue_style()` 
     89* Harden: Use 'esc_like()` on the pingback/trackback URL prior to use in queries 
     90* Bugfix: Use proper existing variable when searching for other pingbacks/trackbacks 
     91* Change: Omit unnecessary appending of '%' to author_url value in call to `get_comments_count()` 
     92* New: Add README.md 
     93* Change: Add GitHub link to readme 
     94* Change: Note compatibility through WP 4.9+ 
     95* Change: Update copyright date (2018) 
     96* Change: Minor whitespace tweaks in unit test bootstrap 
    8497 
    8598= 1.8 (2017-03-04) = 
     
    228241== Upgrade Notice == 
    229242 
     243= 1.9 = 
     244Recommended update: fixed compatibility conflicts with Akismet; fixed incorrect counts for pingbacks/trackbacks; verified compatibility through WP 4.9; updated copyright date (2018). 
     245 
    230246= 1.8 = 
    231247Recommended update: adopted WP comments bubble red circle superscript to display pending comments count, shown comments bubble in users listing, noted compatibility through WP 4.7+, dropped compatibility with WP older than 4.6, more 
  • admin-commenters-comments-count/tags/1.9/tests/bootstrap.php

    r1611510 r1819435  
    66 */ 
    77 
    8 ini_set('display_errors','on'); 
    9 error_reporting(E_ALL); 
     8ini_set( 'display_errors', 'on' ); 
     9error_reporting( E_ALL ); 
    1010 
    1111$_tests_dir = getenv( 'WP_TESTS_DIR' ); 
    1212if ( ! $_tests_dir ) { 
    13         $_tests_dir = '/tmp/wordpress-tests-lib'; 
     13    $_tests_dir = '/tmp/wordpress-tests-lib'; 
    1414} 
    1515 
     
    2121 */ 
    2222function _manually_load_plugin() { 
    23         require dirname( dirname( __FILE__ ) ) . '/admin-commenters-comments-count.php'; 
     23    require dirname( dirname( __FILE__ ) ) . '/admin-commenters-comments-count.php'; 
    2424} 
    2525tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); 
  • admin-commenters-comments-count/tags/1.9/tests/test-admin-commenters-comments-count.php

    r1611510 r1819435  
    117117 
    118118    public function test_plugin_version() { 
    119         $this->assertEquals( '1.8', c2c_AdminCommentersCommentsCount::version() ); 
     119        $this->assertEquals( '1.9', c2c_AdminCommentersCommentsCount::version() ); 
    120120    } 
    121121 
     
    245245    } 
    246246 
     247    public function test_get_comments_count_on_pingback() { 
     248        $this->create_comments( null, 2, 'A pingbacking site', array( 
     249            'comment_author'       => 'A pingbacking site', 
     250            'comment_author_email' => '', 
     251            'comment_author_url'   => 'http://example.com/post-that-pinged-back/', 
     252            'comment_type'         => 'pingback', 
     253        ) ); 
     254        $this->create_comments( null, 1, 'A pingbacking site', array( 
     255            'comment_author'       => 'A pingbacking site', 
     256            'comment_author_email' => '', 
     257            'comment_author_url'   => 'http://example.com/post-that-pinged-back/', 
     258            'comment_type'         => 'pingback', 
     259        ) ); 
     260        $this->create_comments( null, 2, 'Another pingbacking site', array( 
     261            'comment_author'       => 'Another pingbacking site', 
     262            'comment_author_email' => '', 
     263            'comment_author_url'   => 'http://test.example.com/post-that-pinged-back/', 
     264            'comment_type'         => 'pingback', 
     265        ) ); 
     266 
     267        $this->assertEquals( array( 3, 0 ), c2c_AdminCommentersCommentsCount::get_comments_count( 'comment_author_url', 'http://example.com/post-that-pinged-back/', 'pingback' ) ); 
     268    } 
     269 
    247270    /* 
    248271     * get_comments_url() 
  • admin-commenters-comments-count/trunk/admin-commenters-comments-count.php

    r1611510 r1819435  
    22/** 
    33 * Plugin Name: Admin Commenters Comments Count 
    4  * Version:     1.8 
     4 * Version:     1.9 
    55 * Plugin URI:  http://coffee2code.com/wp-plugins/admin-commenters-comments-count/ 
    66 * Author:      Scott Reilly 
     
    1111 * Description: Displays a count of each commenter's total number of comments (linked to those comments) next to their name on any admin page. 
    1212 * 
    13  * Compatible with WordPress 4.6 through 4.7+. 
     13 * Compatible with WordPress 4.6 through 4.9+. 
    1414 * 
    1515 * =>> Read the accompanying readme.txt file for instructions and documentation. 
     
    1919 * @package Admin_Commenters_Comments_Count 
    2020 * @author  Scott Reilly 
    21  * @version 1.8 
     21 * @version 1.9 
    2222 */ 
    2323 
     
    3030 *   email addresses in the group. Via filter maybe? 
    3131 * - Add sortability to 'Comments' column in user table 
     32 * - Consider inserting commenter bomment bubble via 'comment_row_actions' hook like Akismet does, though that 
     33 *   requires introducing a JS dependency. 
    3234 * 
    3335 */ 
    3436 
    3537/* 
    36     Copyright (c) 2009-2017 by Scott Reilly (aka coffee2code) 
     38    Copyright (c) 2009-2018 by Scott Reilly (aka coffee2code) 
    3739 
    3840    This program is free software; you can redistribute it and/or 
     
    105107     */ 
    106108    public static function version() { 
    107         return '1.8'; 
     109        return '1.9'; 
    108110    } 
    109111 
     
    131133        add_filter( 'manage_users_columns',       array( __CLASS__, 'add_user_column'         )        ); 
    132134        add_filter( 'manage_users_custom_column', array( __CLASS__, 'handle_column_data'      ), 10, 3 ); 
     135 
     136        // Disable Akismet's version of this functionality. 
     137        add_filter( 'akismet_show_user_comments_approved', '__return_false' ); 
    133138    } 
    134139 
     
    148153     */ 
    149154    public static function enqueue_admin_css() { 
    150         wp_register_style( __CLASS__ . '_admin', plugins_url( 'assets/admin.css', __FILE__ ) ); 
    151         wp_enqueue_style( __CLASS__ . '_admin', false, array(), self::version() ); 
     155        wp_enqueue_style( __CLASS__ . '_admin', plugins_url( 'assets/admin.css', __FILE__ ), array(), self::version() ); 
    152156    } 
    153157 
     
    226230        } elseif ( 'pingback' == $type || 'trackback' == $type ) { 
    227231            $query = "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_author_url LIKE %s AND comment_type = %s AND comment_approved = %d"; 
    228             $comment_count = $wpdb->get_var( $wpdb->prepare( $query, $author_url.'%', $type, 1 ) ); 
    229             $pending_count = $wpdb->get_var( $wpdb->prepare( $query, $author_url.'%', $type, 0 ) ); 
     232            $comment_count = $wpdb->get_var( $wpdb->prepare( $query, $wpdb->esc_like( $value ) . '%', $type, 1 ) ); 
     233            $pending_count = $wpdb->get_var( $wpdb->prepare( $query, $wpdb->esc_like( $value ) . '%', $type, 0 ) ); 
    230234        } else { 
    231235            $comment_count = $pending_count = 0; 
     
    293297            $parsed_url = parse_url( $author_url ); 
    294298            $author_url = $parsed_url['scheme'] . '://' . $parsed_url['host']; 
    295             list( $comment_count, $pending_count ) = self::get_comments_count( 'comment_author_url', $author_url . '%', $type ); 
     299            list( $comment_count, $pending_count ) = self::get_comments_count( 'comment_author_url', $author_url, $type ); 
    296300            $author_email = $author_url; 
    297301            /* Translators: sorry, but I'm not supplying explicit translation strings for all possible other comment types. 
  • admin-commenters-comments-count/trunk/assets/admin.css

    r1611510 r1819435  
    88    margin-right: 21px; 
    99} 
     10 
    1011.column-commenters_count { 
    1112    width: 74px; 
     
    1516    float: none; 
    1617} 
     18 
     19/* Explicitly set font color with a specifity to override a too-broadly applied style (by Akismet). */ 
     20#the-comment-list .author .author-com-count a span { 
     21    color: #fff; 
     22} 
     23 
    1724@media screen and (max-width: 782px) { 
    1825    .wp-list-table.users .author-com-count { 
  • admin-commenters-comments-count/trunk/readme.txt

    r1611510 r1819435  
    66License URI: http://www.gnu.org/licenses/gpl-2.0.html 
    77Requires at least: 4.6 
    8 Tested up to: 4.7 
    9 Stable tag: 1.8 
     8Tested up to: 4.9 
     9Stable tag: 1.9 
    1010 
    1111Displays a count of each commenter's total number of comments (linked to those comments) next to their name on any admin page. 
     
    3535Commenters are identified by the email address they provided when commenting. If your site does not require that commenters submit their email address when commenting, this plugin will use the commenter's name as the identifier, though since this is a publicly viewable piece of data it's possible that multiple people could be posting under the same "name", so this method has the potential to be not as accurate. 
    3636 
    37 Links: [Plugin Homepage](http://coffee2code.com/wp-plugins/admin-commenters-comments-count/) | [Plugin Directory Page](https://wordpress.org/plugins/admin-commenters-comments-count/) | [Author Homepage](http://coffee2code.com) 
     37Links: [Plugin Homepage](http://coffee2code.com/wp-plugins/admin-commenters-comments-count/) | [Plugin Directory Page](https://wordpress.org/plugins/admin-commenters-comments-count/) | [GitHub](https://github.com/coffe2code/admin-commenters-comments-count/) | [Author Homepage](http://coffee2code.com) 
    3838 
    3939 
     
    8282 
    8383== Changelog == 
     84 
     85= 1.9 (2017-11-06) = 
     86* Bugfix: Explicitly set comment count font color to avoid style conflict with Akismet that resulted in gray text on dark gray background 
     87* Bugfix: Disable Akismet's version of the functionality since it is duplicative and interferes with author section layout 
     88* Change: Omit unnecessary `wp_register_style()` and instead provide all arguments to `wp_enqueue_style()` 
     89* Harden: Use 'esc_like()` on the pingback/trackback URL prior to use in queries 
     90* Bugfix: Use proper existing variable when searching for other pingbacks/trackbacks 
     91* Change: Omit unnecessary appending of '%' to author_url value in call to `get_comments_count()` 
     92* New: Add README.md 
     93* Change: Add GitHub link to readme 
     94* Change: Note compatibility through WP 4.9+ 
     95* Change: Update copyright date (2018) 
     96* Change: Minor whitespace tweaks in unit test bootstrap 
    8497 
    8598= 1.8 (2017-03-04) = 
     
    228241== Upgrade Notice == 
    229242 
     243= 1.9 = 
     244Recommended update: fixed compatibility conflicts with Akismet; fixed incorrect counts for pingbacks/trackbacks; verified compatibility through WP 4.9; updated copyright date (2018). 
     245 
    230246= 1.8 = 
    231247Recommended update: adopted WP comments bubble red circle superscript to display pending comments count, shown comments bubble in users listing, noted compatibility through WP 4.7+, dropped compatibility with WP older than 4.6, more 
  • admin-commenters-comments-count/trunk/tests/bootstrap.php

    r1611510 r1819435  
    66 */ 
    77 
    8 ini_set('display_errors','on'); 
    9 error_reporting(E_ALL); 
     8ini_set( 'display_errors', 'on' ); 
     9error_reporting( E_ALL ); 
    1010 
    1111$_tests_dir = getenv( 'WP_TESTS_DIR' ); 
    1212if ( ! $_tests_dir ) { 
    13         $_tests_dir = '/tmp/wordpress-tests-lib'; 
     13    $_tests_dir = '/tmp/wordpress-tests-lib'; 
    1414} 
    1515 
     
    2121 */ 
    2222function _manually_load_plugin() { 
    23         require dirname( dirname( __FILE__ ) ) . '/admin-commenters-comments-count.php'; 
     23    require dirname( dirname( __FILE__ ) ) . '/admin-commenters-comments-count.php'; 
    2424} 
    2525tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); 
  • admin-commenters-comments-count/trunk/tests/test-admin-commenters-comments-count.php

    r1611510 r1819435  
    117117 
    118118    public function test_plugin_version() { 
    119         $this->assertEquals( '1.8', c2c_AdminCommentersCommentsCount::version() ); 
     119        $this->assertEquals( '1.9', c2c_AdminCommentersCommentsCount::version() ); 
    120120    } 
    121121 
     
    245245    } 
    246246 
     247    public function test_get_comments_count_on_pingback() { 
     248        $this->create_comments( null, 2, 'A pingbacking site', array( 
     249            'comment_author'       => 'A pingbacking site', 
     250            'comment_author_email' => '', 
     251            'comment_author_url'   => 'http://example.com/post-that-pinged-back/', 
     252            'comment_type'         => 'pingback', 
     253        ) ); 
     254        $this->create_comments( null, 1, 'A pingbacking site', array( 
     255            'comment_author'       => 'A pingbacking site', 
     256            'comment_author_email' => '', 
     257            'comment_author_url'   => 'http://example.com/post-that-pinged-back/', 
     258            'comment_type'         => 'pingback', 
     259        ) ); 
     260        $this->create_comments( null, 2, 'Another pingbacking site', array( 
     261            'comment_author'       => 'Another pingbacking site', 
     262            'comment_author_email' => '', 
     263            'comment_author_url'   => 'http://test.example.com/post-that-pinged-back/', 
     264            'comment_type'         => 'pingback', 
     265        ) ); 
     266 
     267        $this->assertEquals( array( 3, 0 ), c2c_AdminCommentersCommentsCount::get_comments_count( 'comment_author_url', 'http://example.com/post-that-pinged-back/', 'pingback' ) ); 
     268    } 
     269 
    247270    /* 
    248271     * get_comments_url() 
Note: See TracChangeset for help on using the changeset viewer.