diff --git a/README.md b/README.md index bce347c..93f618e 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,10 @@ See the [screenshots](/assets/) for more details. ## Changelog +Version 1.6 (26 Feb 2017) + * Add `Unanswered` tab, could show the comments that have not received a reply by internal user yet. + * Experimental feature: public comments search shortcode support(need enable `WPCM_ENABLE_EXPERIMENTAL_FEATURES` first). + Version 1.5.1 (11 Feb 2017) * Fix some bugs. diff --git a/readme.txt b/readme.txt index ab03d0b..50ddbd1 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate Link: https://kn007.net/donate/ Tags: comments, view, spam, control, ajax, search, management, manager, comment search, comment view, comment edit, comment reply, comment approval, comment moderation, comment spam, comment trash, comment delete Requires at least: 3.6 Tested up to: 4.7.2 -Stable tag: 1.5.1 +Stable tag: 1.6 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -49,6 +49,10 @@ No technical skills needed. == Changelog == += 1.6 = +* Add `Unanswered` tab, could show the comments that have not received a reply by internal user yet. +* Experimental feature: public comments search shortcode support(need enable `WPCM_ENABLE_EXPERIMENTAL_FEATURES` first). + = 1.5.1 = * Fix some bugs. diff --git a/wp-comments-manager.php b/wp-comments-manager.php index 632aec2..faf84e4 100644 --- a/wp-comments-manager.php +++ b/wp-comments-manager.php @@ -2,7 +2,7 @@ /* Plugin Name: Wordpress Comments Manager Plugin URI: https://kn007.net/topics/new-wordpress-comment-management-system/ -Version: 1.5.1 +Version: 1.6 Description: Wordpress Comments Manager help you to quickly find comments and manage comments. It can be very convenient to review selected comments, open the comment in a new window, reply comment, edit comment and delete comments. See the screenshots for more details. Author: kn007 Author URI: https://kn007.net/ @@ -12,6 +12,12 @@ if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) wp_die('Wordpress version too old. Please upgrade your Wordpress.'); +define('WPCM_VERSION', '1.6'); +define('WPCM_ENABLE_EXPERIMENTAL_FEATURES', false); + +wp_register_script( 'wpcm', plugins_url("wpcm.js", __FILE__), 'jquery', WPCM_VERSION ); +wp_register_style( 'wpcm', plugins_url("wpcm.css", __FILE__), array(), WPCM_VERSION ); + function wpcm_menu() { if (current_user_can('moderate_comments')) { $page_hook = add_menu_page("Comments Manager","Comments Manager", 'manage_options', 'wordpress-comments-manager', 'wpcm_page'); @@ -23,20 +29,21 @@ function wpcm_menu() { function wpcm_script() { wp_enqueue_script( 'jquery' ); - wp_enqueue_script( 'wpcm', plugins_url("wpcm.js", __FILE__), 'jquery', "1.5" ); + wp_enqueue_script( 'wpcm' ); } function wpcm_style() { - wp_enqueue_style( 'wpcm', plugins_url("wpcm.css", __FILE__), array(), "1.5" ); + wp_enqueue_style( 'wpcm' ); } function wpcm_bar($wp_admin_bar) { - $wp_admin_bar->add_node( array( + $args = array( 'id' => 'wordpress-comments-manager', 'title' => 'Comments Manager', - 'href' => admin_url("admin.php?page=wordpress-comments-manager"), - 'parent'=> 'site-name' - ) ); + 'href' => admin_url("admin.php?page=wordpress-comments-manager") + ); + if (wp_is_mobile()) $args = array_merge( $args, array('parent' => 'site-name') ); + $wp_admin_bar->add_node( $args ); } add_action( 'admin_bar_menu', 'wpcm_bar', 99999 ); @@ -62,29 +69,36 @@ function wpcm_get_item($order) { return $res; } -function wpcm_get_data($order) { +function wpcm_get_data($order, $_limited = false) { global $wpdb; // prepare search - if (!isset($order['approved'])) $order['approved'] = ''; - switch ($order['approved']) { - case 'approve': - case '1': - $order['approved'] = 'comment_approved="1"'; - break; - case 'hold': - case '0': - $order['approved'] = 'comment_approved="0"'; - break; - case 'spam': - $order['approved'] = 'comment_approved="spam"'; - break; - case 'trash': - $order['approved'] = 'comment_approved="trash"'; - break; - case 'all': - default: - $order['approved'] = ''; - break; + if ($_limited) { + $order['approved'] = 'comment_approved="1"'; + } else { + if (!isset($order['approved'])) $order['approved'] = ''; + switch ($order['approved']) { + case 'unanswered': + $order['approved'] = "comment_ID NOT IN (SELECT comment_parent FROM `".$wpdb->comments."` WHERE user_id != 0 AND comment_parent != 0) AND comment_approved IN (0,1) AND user_id = 0"; + break; + case 'approve': + case '1': + $order['approved'] = 'comment_approved="1"'; + break; + case 'hold': + case '0': + $order['approved'] = 'comment_approved="0"'; + break; + case 'spam': + $order['approved'] = 'comment_approved="spam"'; + break; + case 'trash': + $order['approved'] = 'comment_approved="trash"'; + break; + case 'all': + default: + $order['approved'] = ''; + break; + } } $where = $order['approved']; if (isset($order['search']) && is_array($order['search'])) { @@ -133,7 +147,11 @@ function wpcm_get_data($order) { $order['limit'] = isset($order['limit']) ? (int) $order['limit'] : 100; $order['offset'] = isset($order['offset']) ? (int) $order['offset'] : 0; // process sql - $sql = "SELECT `comment_ID`,`comment_author`,`comment_author_email`,`comment_author_url`,`comment_content`,`comment_author_IP`,`comment_date`,`comment_agent` FROM `".$wpdb->comments."` WHERE ".$where; + if ($_limited) { + $sql = "SELECT `comment_ID`,`comment_author`,`comment_content`,`comment_date` FROM `".$wpdb->comments."` WHERE ".$where; + } else { + $sql = "SELECT `comment_ID`,`comment_author`,`comment_author_email`,`comment_author_url`,`comment_content`,`comment_author_IP`,`comment_date`,`comment_agent` FROM `".$wpdb->comments."` WHERE ".$where; + } $cql = "SELECT count(1) FROM ($sql) as grid_list_1"; if ($order['offset'] == 0) { $sql .= " ORDER BY `comment_ID` DESC LIMIT ".$order['limit']; @@ -319,10 +337,10 @@ function wpcm_delete_comments($order) { return $res; } -function wpcm_page(){ +function wpcm_page() { ?>
Version: (Changelog)