{"id":211,"date":"2009-04-06T18:44:35","date_gmt":"2009-04-06T23:44:35","guid":{"rendered":"http:\/\/coffee2code.com\/?page_id=211"},"modified":"2010-08-22T18:40:06","modified_gmt":"2010-08-22T23:40:06","slug":"one-click-close-comments","status":"publish","type":"page","link":"https:\/\/coffee2code.com\/wp-plugins\/one-click-close-comments\/","title":{"rendered":"One Click Close Comments"},"content":{"rendered":"<dl id=\"plugin\">\n<dd class=\"attrib\"><span>Author:<\/span> Scott Reilly<\/dd>\n<dd class=\"attrib\"><span>Version:<\/span> 3.0<\/dd>\n<dd class=\"attrib\"><span>First released:<\/span> 2009-06-12<\/dd>\n<dd class=\"attrib\"><span>Last update:<\/span> 2025-04-17<\/dd>\n<dd class=\"attrib\"><span>Compatibility:<\/span> WP 4.7 &#8211; 6.8.5<\/dd>\n<dd class=\"attrib\"><span>Download:<\/span><span> [ <a href=\"https:\/\/downloads.wordpress.org\/plugin\/one-click-close-comments.3.0.zip\">zip<\/a> ]<\/dd>\n<dd class=\"attrib\"><span>Description:<\/span><\/p>\n<div>Conveniently close or open comments for a post or page with one click from the admin listing of posts.<\/div>\n<\/dd>\n<p><!--more--><\/p>\n<dd>\n<h3>Extended Description<\/h3>\n<div>\n<p>From the admin listing of posts (&#8216;Edit Posts&#8217;) and pages (&#8216;Edit Pages&#8217;), a user can close or open comments to any posts to which they have sufficient privileges to make such changes (essentially admins and post authors for their own posts). This is done via an AJAX-powered color-coded indicator. The color-coding gives instant feedback on the current status of the post for comments: green means the post\/page is open to comments, red means the post\/page is closed to comments. Being AJAX-powered means that the change is submitted in the background after being clicked without requiring a page reload.<\/p>\n<p>This plugin will only function for administrative users in the admin who have JavaScript enabled.<\/p>\n<p>Links: <a href=\"https:\/\/coffee2code.com\/wp-plugins\/one-click-close-comments\/\" rel=\"nofollow ugc\">Plugin Homepage<\/a> | <a href=\"https:\/\/wordpress.org\/plugins\/one-click-close-comments\/\" rel=\"ugc\">Plugin Directory Page<\/a> | <a href=\"https:\/\/github.com\/coffee2code\/one-click-close-comments\/\" rel=\"nofollow ugc\">GitHub<\/a> | <a href=\"https:\/\/coffee2code.com\" rel=\"nofollow ugc\">Author Homepage<\/a><\/p>\n<h3>Developer Documentation<\/h3>\n<p>Developer documentation can be found in <a href=\"https:\/\/github.com\/coffee2code\/one-click-close-comments\/blob\/master\/DEVELOPER-DOCS.md\" rel=\"nofollow ugc\">DEVELOPER-DOCS.md<\/a>. That documentation covers the hooks provided by the plugin.<\/p>\n<p>As an overview, these are the hooks provided by the plugin:<\/p>\n<ul>\n<li><code>c2c_one_click_close_comments_click_char<\/code> : Filter to customize the character, string, or markup used as the indicator used to toggle a post&#8217;s comment status.<\/li>\n<\/ul>\n<p>Find out more at <a href=\"https:\/\/wordpress.org\/plugins\/one-click-close-comments\/\">the plugin&#8217;s WordPress Plugin Repository page<\/a>.<\/p>\n<\/div>\n<\/dd>\n<dd class=\"screenshot\">\n<h3>Screenshots<\/h3>\n<p><em>Click to see full-size image.<\/em><\/p>\n<ol>\n<li><a href=\"https:\/\/ps.w.org\/one-click-close-comments\/assets\/screenshot-1.png?rev=2055754\"><img src=\"https:\/\/ps.w.org\/one-click-close-comments\/assets\/screenshot-1.png?rev=2055754\" alt=\"A screenshot of the &#039;Posts&#039; admin page with the plugin activated. The tooltip (from hovering over a green indicator) reads: &quot;Comments are open. Click to close.&quot; Were the mouse to hover over a red indicator, the tooltip would read: &quot;Comments are closed. Click to open.&quot;\"><\/a>\n<p>A screenshot of the &#8216;Posts&#8217; admin page with the plugin activated. The tooltip (from hovering over a green indicator) reads: &#8220;Comments are open. Click to close.&#8221; Were the mouse to hover over a red indicator, the tooltip would read: &#8220;Comments are closed. Click to open.&#8221;<\/p>\n<\/li>\n<\/ol>\n<\/dd>\n<dd><a name=\"installation\"><\/a><\/p>\n<h3>Installation<\/h3>\n<div>\n<ol>\n<li>Install via the built-in WordPress plugin installer. Or install the plugin code inside the plugins directory for your site (typically <code>\/wp-content\/plugins\/<\/code>).<\/li>\n<li>Activate the plugin through the &#8216;Plugins&#8217; admin menu in WordPress<\/li>\n<li>When on the &#8216;Edit Posts&#8217; or &#8216;Edit Pages&#8217; admin pages, click the indicators to toggle the comment status for a post, as necessary.<\/li>\n<\/ol>\n<\/div>\n<\/dd>\n<dd>\n<\/dd>\n<dd><a name=\"releaselog\"><\/a><\/p>\n<h3>Release Log<\/h3>\n<h4>3.0 (2025-04-17)<\/h4>\n<ul>\n<li>Change: Improve accessibility\n<ul>\n<li>Change: Use a semantic <code>button<\/code> instead of a <code>span<\/code><\/li>\n<li>New: Allow comment state buttons to be navigable by keyboard<\/li>\n<li>New: Allow keyboard control by having the spacebar toggle comment state when toggle is focused<\/li>\n<\/ul>\n<\/li>\n<li>Change: Reimplement JavaScript to use vanilla JS and discontinue use of jQuery<\/li>\n<li>Change: Prevent UI cues indicating comment status might be changeable to users who cannot change them (they never could)\n<ul>\n<li>Change: Prevent cursor from changing to pointer when comment status cannot be changed<\/li>\n<li>Change: Prevent asynchronous JS submission of request to toggle comment status<\/li>\n<\/ul>\n<\/li>\n<li>Change: Prevent display and use of comment status indicator for post types that don&#8217;t support comments<\/li>\n<li>Change: Improve nonce handling\n<ul>\n<li>Change: Generate a unique nonce per post rather than a generic nonce<\/li>\n<li>Change: Store nonce in &#8216;data-nonce&#8217; attribute rather than &#8216;id&#8217;<\/li>\n<li>Change: Use unused private static class variable &#8216;nonce_field&#8217; as base for nonce field key and value<\/li>\n<\/ul>\n<\/li>\n<li>Change: Use result of update to recognize if the comment status didn&#8217;t get changed for some reason<\/li>\n<li>Change: Ensure AJAX response is only ever an integer<\/li>\n<li>Change: Remove any markup potentially introduced in a string translation<\/li>\n<li>Fix: Restore changing mouse cursor to a pointer on hover<\/li>\n<li>Change: Assign additional generic class of &#8216;comment_state&#8217; to indicator markup<\/li>\n<li>Change: Reset field_title variable in <code>reset()<\/code> and use <code>reset()<\/code> during initialization<\/li>\n<li>Change: Use <code>update()<\/code> rather than <code>query()<\/code> for making SQL update request<\/li>\n<li>New: Add inline documentation to class variables<\/li>\n<li>New: Add recommendation for Add Admin CSS plugin for adding the CSS suggested in FAQ entry related to customizing indicator<\/li>\n<li>New: Add DEVELOPER-DOCS.md and move hooks documentation into it<\/li>\n<li>Change: Discontinue unnecessary explicit loading of textdomain<\/li>\n<li>Change: Prevent unwarranted PHPCS complaints<\/li>\n<li>Change: Tweak some text in the FAQ section, including fixing a typo<\/li>\n<li>Change: Note compatibility through WP 6.8+<\/li>\n<li>Change: Update copyright date (2025)<\/li>\n<li>Change: Note compatibility through PHP 8.3+<\/li>\n<li>Change: Tweak installation instruction<\/li>\n<li>Change: Reduce number of &#8216;Tags&#8217; in readme.txt<\/li>\n<li>Change: Remove development and testing related files from release packaging<\/li>\n<li>Unit tests:\n<ul>\n<li>Fix: Allow tests to run against current versions of WordPress<\/li>\n<li>Hardening: Prevent direct web access to <code>bootstrap.php<\/code><\/li>\n<li>Change: Restructure unit test directories\n<ul>\n<li>Change: Move <code>bin\/<\/code> into <code>tests\/<\/code><\/li>\n<li>Change: Move <code>tests\/bootstrap.php<\/code> into <code>tests\/phpunit\/<\/code><\/li>\n<li>Change: Move <code>tests\/test-one-click-close-comments.php<\/code> into <code>tests\/phpunit\/tests\/<\/code><\/li>\n<\/ul>\n<\/li>\n<li>Change: Remove &#8216;test-&#8216; prefix from unit test files<\/li>\n<li>Change: In bootstrap, store path to plugin file constant<\/li>\n<li>Change: In bootstrap, add backcompat for PHPUnit pre-v6.0<\/li>\n<li>Change: Rename <code>phpunit.xml<\/code> to <code>phpunit.xml.dist<\/code> per best practices<\/li>\n<li>New: Add <code>composer.json<\/code> for PHPUnit Polyfill dependency<\/li>\n<li>Change: Explicitly define return type for overridden methods<\/li>\n<\/ul>\n<\/li>\n<li>New: Add a few more possible TODO items<\/li>\n<\/ul>\n<h4>2.7.1 (2021-04-01)<\/h4>\n<ul>\n<li>New: Add a unit test<\/li>\n<li>Change: Note compatibility through WP 5.7+<\/li>\n<li>Change: Update copyright date (2021)<\/li>\n<\/ul>\n<h4>2.7 (2020-08-02)<\/h4>\n<ul>\n<li>This recommended release updates its JavaScript, streamlines markup output, adds unit testing, adds a TODO.md file, updates a few URLs to be HTTPS, notes compatibility through 5.4+, and other minor behind-the-scenes improvements.<\/li>\n<\/ul>\n<p>Details:<\/p>\n<ul>\n<li>New: Extract code for determining click character into new <code>get_click_char()<\/code><\/li>\n<li>New: Add unit tests<\/li>\n<li>New: Add <code>reset()<\/code> for resetting memoized variables<\/li>\n<li>New: Add TODO.md and move existing TODO list from top of main plugin file into it (and add items to it)<\/li>\n<li>Change: Improve output of markup\n<ul>\n<li>Remove encompassing <code>span<\/code> only shown for users authorized to toggle comment status<\/li>\n<li>Add &#8216;title&#8217; attribute to primary span to indicate current state<\/li>\n<li>Change text to not indicate that comment staus can be toggled when user does not have that capability<\/li>\n<\/ul>\n<\/li>\n<li>Change: Update JavaScript\n<ul>\n<li>Change: Migrate use of deprecated <code>.live()<\/code> to <code>.on()<\/code><\/li>\n<li>Change: Handle removal of a previously encapsulating <code>span<\/code><\/li>\n<li>Change: Remove unused code<\/li>\n<li>Change: Update code syntax<\/li>\n<\/ul>\n<\/li>\n<li>Change: Allow class to be defined even when loaded outside the admin<\/li>\n<li>Change: Return &#8216;-1&#8217; to Ajax requests that don&#8217;t result in the comment status being toggled<\/li>\n<li>Change: Add <code>$and_exit<\/code> argument to <code>toggle_comment_status()<\/code> to prevent exiting in order to facilitate unit testing<\/li>\n<li>Change: Refactor <code>add_post_column()<\/code> to be more concise<\/li>\n<li>Change: Add inline docs for deprecated filter <code>one-click-close-comments-click-char<\/code><\/li>\n<li>Change: Switch to use of strict equality operator instead of simple equality operator<\/li>\n<li>Change: Note compatibility through WP 5.4+<\/li>\n<li>Change: Update links to <a href=\"http:\/\/coffee2code.com\" class=\"autohyperlink\" target=\"_blank\">coffee2code.com<\/a> to be HTTPS<\/li>\n<\/ul>\n<\/dd>\n<dd><a name=\"copyright\"><\/a><\/p>\n<h3>Copyright &#038; Disclaimer<\/h3>\n<div class=\"disclaimer\">\nCopyright \u00a9 2009-2026 by Scott Reilly (aka coffee2code)<\/p>\n<p>This program is free software; you can redistribute it and\/or<br \/>\nmodify it under the terms of the GNU General Public License<br \/>\nas published by the Free Software Foundation; either version 2<br \/>\nof the License, or (at your option) any later version.<\/p>\n<p>This program is distributed in the hope that it will be useful,<br \/>\nbut WITHOUT ANY WARRANTY; without even the implied warranty of<br \/>\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br \/>\nGNU General Public License for more details.<\/p>\n<p>You should have received a copy of the GNU General Public License<br \/>\nalong with this program; if not, write to the Free Software<br \/>\nFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n<\/p><\/div>\n<\/dd>\n<dd><a name=\"discussion\"><\/a><\/p>\n<h3>Discussion \/ Support<\/h3>\n<p>Have any questions, comments, or suggestions? Please provide them via the <a href=\"https:\/\/wordpress.org\/support\/plugin\/one-click-close-comments\/\">plugin&#8217;s WordPress.org support forum<\/a>. I&#8217;ll do my best to reply in a timely fashion and help as best I can.<\/p>\n<p>Unfortunately, I cannot provide guaranteed support, nor do I provide support via any other means.<\/p>\n<p>Was this plugin useful useful to you? Consider <a href=\"https:\/\/wordpress.org\/support\/view\/plugin-reviews\/one-click-close-comments\">giving it a rating<\/a>. If you&#8217;re inclined to give it a poor rating, please first post to the support forum to give me a chance to address or explain the situation.\n<\/dl>","protected":false},"excerpt":{"rendered":"<p>Author: Scott Reilly Version: 3.0 First released: 2009-06-12 Last update: 2025-04-17 Compatibility: WP 4.7 &#8211; 6.8.5 Download: [ zip ] Description: Conveniently close or open comments for a post or page with one click from the admin listing of posts. Extended Description From the admin listing of posts (&#8216;Edit Posts&#8217;) and pages (&#8216;Edit Pages&#8217;), a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":51,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/coffee2code.com\/wp-json\/wp\/v2\/pages\/211"}],"collection":[{"href":"https:\/\/coffee2code.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/coffee2code.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/coffee2code.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coffee2code.com\/wp-json\/wp\/v2\/comments?post=211"}],"version-history":[{"count":4,"href":"https:\/\/coffee2code.com\/wp-json\/wp\/v2\/pages\/211\/revisions"}],"predecessor-version":[{"id":548,"href":"https:\/\/coffee2code.com\/wp-json\/wp\/v2\/pages\/211\/revisions\/548"}],"up":[{"embeddable":true,"href":"https:\/\/coffee2code.com\/wp-json\/wp\/v2\/pages\/51"}],"wp:attachment":[{"href":"https:\/\/coffee2code.com\/wp-json\/wp\/v2\/media?parent=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}