WP Updates Notifier - Version 1.1

Version Description

  • Plugin update notification email now includes links to new theme/plugin description and changelog page.
  • Plugin update notification email now shows compatibility of a new plugin. This is same functionality that appears in the WP update area.
  • On plugin activation the first update check is scheduled to run an hour after rather than straight away. This stops current awaiting updates being sent to admin email before you've had chance to change the email settings.
Download this release

Release Info

Developer l3rady
Plugin Icon wp plugin WP Updates Notifier
Version 1.1
Comparing to
See all releases

Code changes from version 1.0.4 to 1.1

Files changed (2) hide show
  1. readme.txt +7 -2
  2. wp-updates-notifier.php +25 -8
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: l3rady
3
  Donate link: http://l3rady.com/donate
4
  Tags: admin, theme, monitor, plugin, notification, upgrade, security
5
  Requires at least: 3.1
6
- Tested up to: 3.2
7
- Stable tag: 1.0.4
8
 
9
  Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
10
 
@@ -47,6 +47,11 @@ This plugin is a fork of [Update Notifier](http://wordpress.org/extend/plugins/u
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
50
  = 1.0.4 =
51
  * Fixed code to not report multiple times of core upgrades. Plugin now only notifies you once of core upgrade until upgrade is done.
52
 
3
  Donate link: http://l3rady.com/donate
4
  Tags: admin, theme, monitor, plugin, notification, upgrade, security
5
  Requires at least: 3.1
6
+ Tested up to: 3.2.1
7
+ Stable tag: 1.1
8
 
9
  Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
10
 
47
 
48
  == Changelog ==
49
 
50
+ = 1.1 =
51
+ * Plugin update notification email now includes links to new theme/plugin description and changelog page.
52
+ * Plugin update notification email now shows compatibility of a new plugin. This is same functionality that appears in the WP update area.
53
+ * On plugin activation the first update check is scheduled to run an hour after rather than straight away. This stops current awaiting updates being sent to admin email before you've had chance to change the email settings.
54
+
55
  = 1.0.4 =
56
  * Fixed code to not report multiple times of core upgrades. Plugin now only notifies you once of core upgrade until upgrade is done.
57
 
wp-updates-notifier.php CHANGED
@@ -4,8 +4,10 @@ Plugin Name: WP Updates Notifier
4
  Plugin URI: http://l3rady.com/projects/wp-updates-notifier/
5
  Description: Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
6
  Author: Scott Cariss
7
- Version: 1.0.4
8
  Author URI: http://l3rady.com/
 
 
9
  */
10
 
11
  /* Copyright 2011 Scott Cariss (email : scott@l3rady.com)
@@ -125,7 +127,7 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
125
  if($currentSchedule != $options['frequency']) { // check if the current schedule matches the one set in settings
126
  if(in_array($options['frequency'], self::$frequency_intervals)) { // check the cron setting is valid
127
  do_action("sc_wpun_disable_cron"); // remove any crons for this plugin first so we don't end up with multiple crons doing the same thing.
128
- wp_schedule_event(time(), $options['frequency'], self::$cron_name); // schedule cron for this plugin.
129
  }
130
  }
131
  }
@@ -182,7 +184,7 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
182
  $themes_updated = false; // no theme updates
183
  }
184
  if ($core_updated || $plugins_updated || $themes_updated) { // Did anything come back as need updating?
185
- $message = __("There are updates available for your WordPress site:", "wp-updates-notifier")."\n\n".$message."\n";
186
  $message .= sprintf(__("Please visit %s to update.", "wp-updates-notifier"), admin_url('update-core.php'));
187
  $this->send_notification_email($message); // send our notification email.
188
  }
@@ -201,10 +203,10 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
201
  $update_core = get_site_transient("update_core"); // get information of updates
202
  if('upgrade' == $update_core->updates[0]->response) { // is WP core update available?
203
  if($update_core->updates[0]->current != $settings['notified']['core']) { // have we already notified about this version?
204
- include( ABSPATH . WPINC . '/version.php' ); // Including this because some plugins can mess with the real version stored in the DB.
205
  $new_core_ver = $update_core->updates[0]->current; // The new WP core version
206
  $old_core_ver = $wp_version; // the old WP core version
207
- $message .= sprintf(__("WP-Core: WordPress is out of date. Please update from version %s to %s", "wp-updates-notifier"), $old_core_ver, $new_core_ver)."\n";
208
  $settings['notified']['core'] = $new_core_ver; // set core version we are notifying about
209
  update_option(self::$options_field, $settings); // update settings
210
  return true; // we have updates so return true
@@ -237,9 +239,23 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
237
  }
238
  $plugins_need_update = apply_filters('sc_wpun_plugins_need_update', $plugins_need_update); // additional filtering of plugins need update
239
  if(count($plugins_need_update) >= 1) { // any plugins need updating after all the filtering gone on above?
 
 
240
  foreach($plugins_need_update as $key => $data) { // loop through the plugins that need updating
241
- $plugin_info = get_plugin_data(WP_PLUGIN_DIR . "/" . $key); // get plugin info
242
- $message .= sprintf(__("Plugin: %s is out of date. Please update from version %s to %s", "wp-updates-notifier"), $plugin_info['Name'], $plugin_info['Version'], $data->new_version)."\n";
 
 
 
 
 
 
 
 
 
 
 
 
243
  $settings['notified']['plugin'][$key] = $data->new_version; // set plugin version we are notifying about
244
  }
245
  update_option(self::$options_field, $settings); // save settings
@@ -276,7 +292,7 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
276
  if(count($themes_need_update) >= 1) { // any themes need updating after all the filtering gone on above?
277
  foreach($themes_need_update as $key => $data) { // loop through the themes that need updating
278
  $theme_info = get_theme_data(WP_CONTENT_DIR . "/themes/" . $key . "/style.css"); // get theme info
279
- $message .= sprintf(__("Theme: %s is out of date. Please update from version %s to %s", "wp-updates-notifier"), $theme_info['Name'], $theme_info['Version'], $data['new_version'])."\n";
280
  $settings['notified']['theme'][$key] = $data['new_version']; // set theme version we are notifying about
281
  }
282
  update_option(self::$options_field, $settings); // save settings
@@ -401,6 +417,7 @@ if (!class_exists('sc_WPUpdatesNotifier')) {
401
  add_settings_field("sc_wpun_settings_main_notify_plugins", __("Notify about plugin updates?", "wp-updates-notifier"), array(&$this, "sc_wpun_settings_main_field_notify_plugins"), "wp-updates-notifier", "sc_wpun_settings_main");
402
  add_settings_field("sc_wpun_settings_main_notify_themes", __("Notify about theme updates?", "wp-updates-notifier"), array(&$this, "sc_wpun_settings_main_field_notify_themes"), "wp-updates-notifier", "sc_wpun_settings_main");
403
  add_settings_field("sc_wpun_settings_main_hide_updates", __("Hide core WP update nag from non-admin users?", "wp-updates-notifier"), array(&$this, "sc_wpun_settings_main_field_hide_updates"), "wp-updates-notifier", "sc_wpun_settings_main");
 
404
  }
405
  public function sc_wpun_settings_validate($input) {
406
  $valid = get_option(self::$options_field);
4
  Plugin URI: http://l3rady.com/projects/wp-updates-notifier/
5
  Description: Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
6
  Author: Scott Cariss
7
+ Version: 1.1
8
  Author URI: http://l3rady.com/
9
+ Text Domain: wp-updates-notifier
10
+ Domain Path: /languages
11
  */
12
 
13
  /* Copyright 2011 Scott Cariss (email : scott@l3rady.com)
127
  if($currentSchedule != $options['frequency']) { // check if the current schedule matches the one set in settings
128
  if(in_array($options['frequency'], self::$frequency_intervals)) { // check the cron setting is valid
129
  do_action("sc_wpun_disable_cron"); // remove any crons for this plugin first so we don't end up with multiple crons doing the same thing.
130
+ wp_schedule_event((time()+3600), $options['frequency'], self::$cron_name); // schedule cron for this plugin.
131
  }
132
  }
133
  }
184
  $themes_updated = false; // no theme updates
185
  }
186
  if ($core_updated || $plugins_updated || $themes_updated) { // Did anything come back as need updating?
187
+ $message = __("There are updates available for your WordPress site:", "wp-updates-notifier")."\n".$message."\n";
188
  $message .= sprintf(__("Please visit %s to update.", "wp-updates-notifier"), admin_url('update-core.php'));
189
  $this->send_notification_email($message); // send our notification email.
190
  }
203
  $update_core = get_site_transient("update_core"); // get information of updates
204
  if('upgrade' == $update_core->updates[0]->response) { // is WP core update available?
205
  if($update_core->updates[0]->current != $settings['notified']['core']) { // have we already notified about this version?
206
+ require_once( ABSPATH . WPINC . '/version.php' ); // Including this because some plugins can mess with the real version stored in the DB.
207
  $new_core_ver = $update_core->updates[0]->current; // The new WP core version
208
  $old_core_ver = $wp_version; // the old WP core version
209
+ $message .= "\n".sprintf(__("WP-Core: WordPress is out of date. Please update from version %s to %s", "wp-updates-notifier"), $old_core_ver, $new_core_ver)."\n";
210
  $settings['notified']['core'] = $new_core_ver; // set core version we are notifying about
211
  update_option(self::$options_field, $settings); // update settings
212
  return true; // we have updates so return true
239
  }
240
  $plugins_need_update = apply_filters('sc_wpun_plugins_need_update', $plugins_need_update); // additional filtering of plugins need update
241
  if(count($plugins_need_update) >= 1) { // any plugins need updating after all the filtering gone on above?
242
+ require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); // Required for plugin API
243
+ require_once(ABSPATH . WPINC . '/version.php' ); // Required for WP core version
244
  foreach($plugins_need_update as $key => $data) { // loop through the plugins that need updating
245
+ $plugin_info = get_plugin_data(WP_PLUGIN_DIR . "/" . $key); // get local plugin info
246
+ $info = plugins_api('plugin_information', array('slug' => $data->slug )); // get repository plugin info
247
+ $message .= "\n".sprintf(__("Plugin: %s is out of date. Please update from version %s to %s", "wp-updates-notifier"), $plugin_info['Name'], $plugin_info['Version'], $data->new_version)."\n";
248
+ $message .= "\t".sprintf(__("Details: %s", "wp-updates-notifier"), $data->url)."\n";
249
+ $message .= "\t".sprintf(__("Changelog: %s%s", "wp-updates-notifier"), $data->url, "changelog/")."\n";
250
+ if ( isset($info->tested) && version_compare($info->tested, $wp_version, '>=') ) {
251
+ $compat = sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
252
+ } elseif ( isset($info->compatibility[$wp_version][$data->new_version]) ) {
253
+ $compat = $info->compatibility[$wp_version][$data->new_version];
254
+ $compat = sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $wp_version, $compat[0], $compat[2], $compat[1]);
255
+ } else {
256
+ $compat = sprintf(__('Compatibility with WordPress %1$s: Unknown'), $wp_version);
257
+ }
258
+ $message .= "\t".sprintf(__("Compatibility: %s", "wp-updates-notifier"), $compat)."\n";
259
  $settings['notified']['plugin'][$key] = $data->new_version; // set plugin version we are notifying about
260
  }
261
  update_option(self::$options_field, $settings); // save settings
292
  if(count($themes_need_update) >= 1) { // any themes need updating after all the filtering gone on above?
293
  foreach($themes_need_update as $key => $data) { // loop through the themes that need updating
294
  $theme_info = get_theme_data(WP_CONTENT_DIR . "/themes/" . $key . "/style.css"); // get theme info
295
+ $message .= "\n".sprintf(__("Theme: %s is out of date. Please update from version %s to %s", "wp-updates-notifier"), $theme_info['Name'], $theme_info['Version'], $data['new_version'])."\n";
296
  $settings['notified']['theme'][$key] = $data['new_version']; // set theme version we are notifying about
297
  }
298
  update_option(self::$options_field, $settings); // save settings
417
  add_settings_field("sc_wpun_settings_main_notify_plugins", __("Notify about plugin updates?", "wp-updates-notifier"), array(&$this, "sc_wpun_settings_main_field_notify_plugins"), "wp-updates-notifier", "sc_wpun_settings_main");
418
  add_settings_field("sc_wpun_settings_main_notify_themes", __("Notify about theme updates?", "wp-updates-notifier"), array(&$this, "sc_wpun_settings_main_field_notify_themes"), "wp-updates-notifier", "sc_wpun_settings_main");
419
  add_settings_field("sc_wpun_settings_main_hide_updates", __("Hide core WP update nag from non-admin users?", "wp-updates-notifier"), array(&$this, "sc_wpun_settings_main_field_hide_updates"), "wp-updates-notifier", "sc_wpun_settings_main");
420
+ $this->plugins_update_check($message, 1);
421
  }
422
  public function sc_wpun_settings_validate($input) {
423
  $valid = get_option(self::$options_field);