WP Notification Bars - Version 1.0.4

Version Description

  • Updated admin notices
Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Notification Bars
Version 1.0.4
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.4

admin/class-wp-notification-bars-admin.php CHANGED
@@ -137,6 +137,15 @@
137
  )
138
  );
139
  }
 
 
 
 
 
 
 
 
 
140
  }
141
 
142
  //////////////////////
@@ -736,7 +745,7 @@
736
  /* Only show the notice 2 days after plugin activation */
737
  if ( ! get_user_meta($user_id, 'wp_notification_bar_ignore_notice') && time() >= (get_option( 'wp_notification_bar_activated', 0 ) + (2 * 24 * 60 * 60)) ) {
738
  echo '<div class="updated notice-info wp-notification-bar-notice" id="wpnotificationbar-notice" style="position:relative;">';
739
- printf(__('<p>Like WP Notification Bar plugin? You will LOVE <a target="_blank" href="https://mythemeshop.com/plugins/wp-notification-bar/?utm_source=WP+Notification+Bars&utm_medium=Notification+Link&utm_content=WP+Notification+Bar+Pro+LP&utm_campaign=WordPressOrg"><strong>WP Notification Bar Pro!</strong></a></p><a class="notice-dismiss" href="%1$s"></a>', $this->plugin_name), '?wp_notification_bar_admin_notice_ignore=0');
740
  echo "</div>";
741
  }
742
  /* Other notice appears right after activating */
@@ -748,7 +757,7 @@
748
  echo '<p>';
749
  _e('Thank you for trying WP Notification Bar. We hope you will like it.', $this->plugin_name);
750
  echo '</p>';
751
- echo '<a class="notice-dismiss" href="?wp_notification_bar_admin_notice_ignore=0"></a>';
752
  echo "</div>";
753
  }
754
  }
@@ -757,10 +766,10 @@
757
  global $current_user;
758
  $user_id = $current_user->ID;
759
  /* If user clicks to ignore the notice, add that to their user meta */
760
- if ( isset($_GET['wp_notification_bar_admin_notice_ignore']) ) {
761
- if ( '0' == $_GET['wp_notification_bar_admin_notice_ignore'] ) {
762
  add_user_meta($user_id, 'wp_notification_bar_ignore_notice', '1', true);
763
- } elseif ( '1' == $_GET['wp_notification_bar_admin_notice_ignore'] ) {
764
  add_user_meta($user_id, 'wp_notification_bar_ignore_notice_2', '1', true);
765
  }
766
  }
137
  )
138
  );
139
  }
140
+
141
+ wp_enqueue_script(
142
+ $this->plugin_name,
143
+ plugin_dir_url( __FILE__ ) . 'js/wp-nb-admin-notices.js',
144
+ array(
145
+ 'jquery',
146
+ ),
147
+ $this->version, false
148
+ );
149
  }
150
 
151
  //////////////////////
745
  /* Only show the notice 2 days after plugin activation */
746
  if ( ! get_user_meta($user_id, 'wp_notification_bar_ignore_notice') && time() >= (get_option( 'wp_notification_bar_activated', 0 ) + (2 * 24 * 60 * 60)) ) {
747
  echo '<div class="updated notice-info wp-notification-bar-notice" id="wpnotificationbar-notice" style="position:relative;">';
748
+ echo __('<p>Like WP Notification Bar plugin? You will LOVE <a target="_blank" href="https://mythemeshop.com/plugins/wp-notification-bar/?utm_source=WP+Notification+Bars&utm_medium=Notification+Link&utm_content=WP+Notification+Bar+Pro+LP&utm_campaign=WordPressOrg"><strong>WP Notification Bar Pro!</strong></a></p><a class="notice-dismiss mtsnb-notice-dismiss" data-ignore="0" href="#"></a>', $this->plugin_name);
749
  echo "</div>";
750
  }
751
  /* Other notice appears right after activating */
757
  echo '<p>';
758
  _e('Thank you for trying WP Notification Bar. We hope you will like it.', $this->plugin_name);
759
  echo '</p>';
760
+ echo '<a class="notice-dismiss mtsnb-notice-dismiss" data-ignore="1" href="#"></a>';
761
  echo "</div>";
762
  }
763
  }
766
  global $current_user;
767
  $user_id = $current_user->ID;
768
  /* If user clicks to ignore the notice, add that to their user meta */
769
+ if ( isset($_POST['dismiss']) ) {
770
+ if ( '0' == $_POST['dismiss'] ) {
771
  add_user_meta($user_id, 'wp_notification_bar_ignore_notice', '1', true);
772
+ } elseif ( '1' == $_POST['dismiss'] ) {
773
  add_user_meta($user_id, 'wp_notification_bar_ignore_notice_2', '1', true);
774
  }
775
  }
admin/js/wp-nb-admin-notices.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).on('click', '.mtsnb-notice-dismiss', function(e){
2
+ e.preventDefault();
3
+ var $this = jQuery(this);
4
+ jQuery.ajax({
5
+ type: "POST",
6
+ url: ajaxurl,
7
+ data: {
8
+ action: 'mts_dismiss_nb_notice',
9
+ dismiss: jQuery(this).data('ignore')
10
+ }
11
+ }).done(function() {
12
+ $this.parent().remove();
13
+ });
14
+ return false;
15
+ });
includes/class-wp-notification-bars.php CHANGED
@@ -162,7 +162,7 @@ class MTSNBF {
162
 
163
  /* Display a notice */
164
  $this->loader->add_action( 'admin_notices', $plugin_admin, 'wp_notification_bar_admin_notice' );
165
- $this->loader->add_action( 'admin_init', $plugin_admin, 'wp_notification_bar_admin_notice_ignore' );
166
 
167
  // Register our post type
168
  $this->loader->add_action( 'init', $plugin_admin, 'mts_notification_cpt' );
162
 
163
  /* Display a notice */
164
  $this->loader->add_action( 'admin_notices', $plugin_admin, 'wp_notification_bar_admin_notice' );
165
+ $this->loader->add_action( 'wp_ajax_mts_dismiss_nb_notice', $plugin_admin, 'wp_notification_bar_admin_notice_ignore' );
166
 
167
  // Register our post type
168
  $this->loader->add_action( 'init', $plugin_admin, 'mts_notification_cpt' );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Creator's website link: http://mythemeshop.com/plugins/wp-notification-bars/
4
  Tags: notification, alert, notification bar, welcome google visitor, welcome facebook visitor, attention bar, floating bar, message, notice, sticky header, offer bar, hello bar
5
  Requires at least: 3.0.1
6
  Tested up to: 4.9.5
7
- Stable tag: 1.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -74,6 +74,9 @@ Please disable all plugins and check if backup is working properly. Then you can
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 1.0.3 =
78
  * Changed admin notices
79
 
4
  Tags: notification, alert, notification bar, welcome google visitor, welcome facebook visitor, attention bar, floating bar, message, notice, sticky header, offer bar, hello bar
5
  Requires at least: 3.0.1
6
  Tested up to: 4.9.5
7
+ Stable tag: 1.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
74
 
75
  == Changelog ==
76
 
77
+ = 1.0.4 =
78
+ * Updated admin notices
79
+
80
  = 1.0.3 =
81
  * Changed admin notices
82
 
wp-notification-bars.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: WP Notification Bars
5
  * Plugin URI: https://mythemeshop.com/plugins/wp-notification-bars/
6
  * Description: WP Notification Bars is a custom notification and alert bar plugin for WordPress which is perfect for marketing promotions, alerts, increasing click throughs to other pages and so much more.
7
- * Version: 1.0.3
8
  * Author: MyThemeShop
9
  * Author URI: https://mythemeshop.com/
10
  * Text Domain: wp-notification-bars
4
  * Plugin Name: WP Notification Bars
5
  * Plugin URI: https://mythemeshop.com/plugins/wp-notification-bars/
6
  * Description: WP Notification Bars is a custom notification and alert bar plugin for WordPress which is perfect for marketing promotions, alerts, increasing click throughs to other pages and so much more.
7
+ * Version: 1.0.4
8
  * Author: MyThemeShop
9
  * Author URI: https://mythemeshop.com/
10
  * Text Domain: wp-notification-bars