Disable Comments - Version 2.0.1

Version Description

Download this release

Release Info

Developer Asif2BD
Plugin Icon 128x128 Disable Comments
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0.0 to 2.0.1

Files changed (3) hide show
  1. disable-comments.php +16 -31
  2. readme.txt +9 -5
  3. views/setup-settings.php +2 -2
disable-comments.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Disable Comments
5
  * Plugin URI: https://wordpress.org/plugins/disable-comments/
6
  * Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. You could bulk delete comments using Tools.
7
- * Version: 2.0.0
8
  * Author: WPDeveloper
9
  * Author URI: https://wpdeveloper.net
10
  * License: GPL-3.0+
@@ -37,7 +37,7 @@ class Disable_Comments
37
 
38
  function __construct()
39
  {
40
- define('DC_VERSION', '2.0.0');
41
  define('DC_PLUGIN_SLUG', 'disable_comments_settings');
42
  define('DC_PLUGIN_ROOT_PATH', dirname(__FILE__));
43
  define('DC_PLUGIN_VIEWS_PATH', DC_PLUGIN_ROOT_PATH . '/views/');
@@ -518,7 +518,7 @@ class Disable_Comments
518
  private function quick_setup_url()
519
  {
520
  $base = $this->networkactive ? network_admin_url('settings.php') : admin_url('admin.php');
521
- return add_query_arg('page', DC_PLUGIN_SLUG . '_setup', $base);
522
  }
523
 
524
  /**
@@ -642,32 +642,20 @@ class Disable_Comments
642
  public function settings_menu()
643
  {
644
  $title = _x('Disable Comments', 'settings menu title', 'disable-comments');
645
-
646
- $slug = DC_PLUGIN_SLUG;
647
-
648
- $is_setup_page = isset( $_GET['page'] ) && trim( $_GET['page'] ) === 'disable_comments_settings_setup';
649
-
650
- if( ! $this->get_option('dc_setup_screen_seen') && ! $is_setup_page ) {
651
- $slug = DC_PLUGIN_SLUG . '_setup';
652
- }
653
-
654
  if ($this->networkactive) {
655
- add_submenu_page('settings.php', $title, $title, 'manage_network_plugins', $slug, array($this, 'settings_page'));
656
  } else {
657
- if( $slug === 'disable_comments_settings_setup' ) {
658
- add_submenu_page('options-general.php', $title, $title, 'manage_options', $slug, array($this, 'setup_settings_page'));
659
- } else {
660
- add_submenu_page('options-general.php', $title, $title, 'manage_options', $slug, array($this, 'settings_page'));
661
- }
 
 
 
 
 
662
  }
663
- add_submenu_page(
664
- null,
665
- $title,
666
- $title,
667
- 'manage_options',
668
- DC_PLUGIN_SLUG . '_setup',
669
- array($this, 'setup_settings_page')
670
- );
671
  }
672
  public function tools_menu()
673
  {
@@ -683,11 +671,8 @@ class Disable_Comments
683
 
684
  public function redirectToMainSettingsPage()
685
  {
686
- if ($this->networkactive) {
687
- wp_redirect($this->settings_page_url() . '#delete');
688
- } else {
689
- wp_redirect( $this->settings_page_url() . '#delete');
690
- }
691
  }
692
 
693
  public function get_all_comments_number()
4
  * Plugin Name: Disable Comments
5
  * Plugin URI: https://wordpress.org/plugins/disable-comments/
6
  * Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. You could bulk delete comments using Tools.
7
+ * Version: 2.0.1
8
  * Author: WPDeveloper
9
  * Author URI: https://wpdeveloper.net
10
  * License: GPL-3.0+
37
 
38
  function __construct()
39
  {
40
+ define('DC_VERSION', '2.0.1');
41
  define('DC_PLUGIN_SLUG', 'disable_comments_settings');
42
  define('DC_PLUGIN_ROOT_PATH', dirname(__FILE__));
43
  define('DC_PLUGIN_VIEWS_PATH', DC_PLUGIN_ROOT_PATH . '/views/');
518
  private function quick_setup_url()
519
  {
520
  $base = $this->networkactive ? network_admin_url('settings.php') : admin_url('admin.php');
521
+ return add_query_arg('page', $this->get_option('dc_setup_screen_seen') ? DC_PLUGIN_SLUG : DC_PLUGIN_SLUG . '_setup', $base);
522
  }
523
 
524
  /**
642
  public function settings_menu()
643
  {
644
  $title = _x('Disable Comments', 'settings menu title', 'disable-comments');
 
 
 
 
 
 
 
 
 
645
  if ($this->networkactive) {
646
+ $hook = add_submenu_page('settings.php', $title, $title, 'manage_network_plugins', DC_PLUGIN_SLUG, array($this, 'settings_page'));
647
  } else {
648
+ $hook = add_submenu_page('options-general.php', $title, $title, 'manage_options', DC_PLUGIN_SLUG, array($this, 'settings_page'));
649
+ }
650
+ add_submenu_page(null, $title, $title, 'manage_options', DC_PLUGIN_SLUG . '_setup', array($this, 'setup_settings_page'));
651
+ add_action('load-' . $hook, array($this, 'root_redirect'));
652
+ }
653
+ public function root_redirect(){
654
+ $is_setup_page = isset( $_GET['page'] ) && trim( $_GET['page'] ) === 'disable_comments_settings_setup';
655
+ if( isset( $_GET['page'] ) && trim( $_GET['page'] ) === 'disable_comments_settings' && ! $this->get_option('dc_setup_screen_seen') && ! $is_setup_page ) {
656
+ wp_safe_redirect( $this->quick_setup_url(), 301 );
657
+ exit;
658
  }
 
 
 
 
 
 
 
 
659
  }
660
  public function tools_menu()
661
  {
671
 
672
  public function redirectToMainSettingsPage()
673
  {
674
+ wp_safe_redirect($this->settings_page_url() . '#delete');
675
+ exit;
 
 
 
676
  }
677
 
678
  public function get_all_comments_number()
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === Disable Comments - Remove Comments & Protect From Spam ===
2
  Contributors: Asif2BD, priyomukul, wpdevteam, re_enter_rupok, tusharimran, alimuzzamanalim, solarissmoke, garrett-eclipse
3
  Donate link: https://wpdeveloper.net/
4
- Tags: comments, delete comments, disable, disable comments, stop spam, remove comments, anti spam, disable xml-rpc, hide comment, XML-RPC, REST-API, WP CLI
5
  Requires at least: 5.0
6
  Tested up to: 5.5
7
- Requires PHP: 5.4
8
- Stable tag: 2.0.0
9
  License: GPL-3.0-or-later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -13,7 +13,7 @@ Allows administrators to globally disable comments on their site. Comments can b
13
 
14
  == Description ==
15
 
16
- Instantly allow or disallow comments from any post type in WordPress (Pages, Posts or Media) to stop the spammers and gain complete control over your full website.
17
 
18
  [More About Plugin](https://wpdeveloper.net/plugins/disable-comments/) ◼️ [Documentation](https://wpdeveloper.net/docs-category/disable-comments/) ◼️ [Support Forum](https://wordpress.org/support/plugin/disable-comments/)
19
 
@@ -169,6 +169,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
169
  and this project adheres to [Semantic Versioning](http://semver.org/).
170
  This will be maiintained from August 19, 2020 - @asif2bd
171
 
 
 
 
 
172
  = [2.0.0] - 2020-11-28 =
173
  * Improved UI for Settings page
174
  * New feature: Manage Disable Comments settings with WP-CLI
@@ -318,4 +322,4 @@ This will be maiintained from August 19, 2020 - @asif2bd
318
 
319
  == Upgrade Notice ==
320
 
321
- Minor Update: Tools update
1
  === Disable Comments - Remove Comments & Protect From Spam ===
2
  Contributors: Asif2BD, priyomukul, wpdevteam, re_enter_rupok, tusharimran, alimuzzamanalim, solarissmoke, garrett-eclipse
3
  Donate link: https://wpdeveloper.net/
4
+ Tags: comments, delete comments, disable, disable comments, stop spam, remove comments, anti spam, disable xml-rpc, hide comment, XML-RPC, REST-API, WP-CLI
5
  Requires at least: 5.0
6
  Tested up to: 5.5
7
+ Requires PHP: 5.6
8
+ Stable tag: 2.0.1
9
  License: GPL-3.0-or-later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
13
 
14
  == Description ==
15
 
16
+ Instantly allow or disallow comments from any post type in WordPress (Pages, Posts or Media) to stop the spammers and gain complete control over your full website. WP-CLI Suppprt & Control comments via XML-RPC and REST-API too!
17
 
18
  [More About Plugin](https://wpdeveloper.net/plugins/disable-comments/) ◼️ [Documentation](https://wpdeveloper.net/docs-category/disable-comments/) ◼️ [Support Forum](https://wordpress.org/support/plugin/disable-comments/)
19
 
169
  and this project adheres to [Semantic Versioning](http://semver.org/).
170
  This will be maiintained from August 19, 2020 - @asif2bd
171
 
172
+ = [2.0.1] - 2020-11-28 =
173
+ * Bug Fix: Settings page URL issue fixed from plugins page.
174
+ * Improvement: Quick Setup Wizard instructions.
175
+
176
  = [2.0.0] - 2020-11-28 =
177
  * Improved UI for Settings page
178
  * New feature: Manage Disable Comments settings with WP-CLI
322
 
323
  == Upgrade Notice ==
324
 
325
+ Major Update: Complete new UI with WP-CLI featuures.
views/setup-settings.php CHANGED
@@ -28,7 +28,7 @@
28
  <div id="dcqTabBody_1" class="dc-quick__step__item">
29
  <div class="quick__setup__item__header mb30">
30
  <h2><?php _e('Getting Started', 'disable-comments'); ?></h2>
31
- <p><?php _e('Easily get started with this easy setup wizard and complete setting up your Knowledge Base.', 'disable-comments'); ?></p>
32
  </div>
33
  <div class="dc-video__area">
34
  <iframe width="622" height="350" src="https://www.youtube.com/embed/J9AteKzQpPs" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
@@ -48,7 +48,7 @@
48
  <div id="dcqTabBody_3" class="dc-quick__step__item">
49
  <div class="quick__setup__item__header">
50
  <h2><?php _e('Great Job!', 'disable-comments'); ?></h2>
51
- <p><?php _e('Your documentation page is ready! Make sure to add more articles and assign them to proper categories and you are good to go.', 'disable-comments'); ?></p>
52
  </div>
53
  <div class="finalize-thumb">
54
  <img src="<?php echo esc_url(DC_ASSETS_URI . 'img/finalize-thumb.png'); ?>" alt="">
28
  <div id="dcqTabBody_1" class="dc-quick__step__item">
29
  <div class="quick__setup__item__header mb30">
30
  <h2><?php _e('Getting Started', 'disable-comments'); ?></h2>
31
+ <p><?php _e('Easily get started with this easy setup wizard and complete setting up your Disable Comments', 'disable-comments'); ?></p>
32
  </div>
33
  <div class="dc-video__area">
34
  <iframe width="622" height="350" src="https://www.youtube.com/embed/J9AteKzQpPs" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
48
  <div id="dcqTabBody_3" class="dc-quick__step__item">
49
  <div class="quick__setup__item__header">
50
  <h2><?php _e('Great Job!', 'disable-comments'); ?></h2>
51
+ <p><?php _e('You are ready to go! You can manage your settings anytime from Settings > Disable Comments', 'disable-comments'); ?></p>
52
  </div>
53
  <div class="finalize-thumb">
54
  <img src="<?php echo esc_url(DC_ASSETS_URI . 'img/finalize-thumb.png'); ?>" alt="">