OneSignal – Free Web Push Notifications - Version 1.0.5

Version Description

Send notification on post is now available to any Wordpress user with permissions to create or edit posts.

Download this release

Release Info

Developer OneSignal
Plugin Icon 128x128 OneSignal – Free Web Push Notifications
Version 1.0.5
Comparing to
See all releases

Code changes from version 1.0.4 to 1.0.5

Files changed (3) hide show
  1. onesignal-admin.php +5 -3
  2. onesignal.php +1 -1
  3. readme.txt +4 -1
onesignal-admin.php CHANGED
@@ -8,12 +8,14 @@ class OneSignal_Admin {
8
  public static function init() {
9
  $onesignal = new self();
10
  if(current_user_can('update_plugins')) {
11
- add_action( 'admin_menu', array(__CLASS__,'add_admin_page') );
 
 
12
  add_action( 'add_meta_boxes_post', array( __CLASS__, 'add_onesignal_post_options' ) );
13
  add_action( 'save_post', array( __CLASS__, 'on_post_save' ) );
14
  }
15
 
16
- // Outside is_admin() to catch posts that go from future to published in the background.
17
  add_action( 'transition_post_status', array( __CLASS__, 'notification_on_blog_post' ), 10, 3 );
18
 
19
  return $onesignal;
@@ -167,7 +169,7 @@ class OneSignal_Admin {
167
  $ch = curl_init();
168
  curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications");
169
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
170
- 'Authorization: Basic ' . $onesignal_wp_settings['app_rest_api_key'])); // TODO: Get auth key from settings
171
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
172
  curl_setopt($ch, CURLOPT_HEADER, FALSE);
173
  curl_setopt($ch, CURLOPT_POST, TRUE);
8
  public static function init() {
9
  $onesignal = new self();
10
  if(current_user_can('update_plugins')) {
11
+ add_action( 'admin_menu', array(__CLASS__, 'add_admin_page') );
12
+ }
13
+ if(current_user_can('publish_posts') || current_user_can('edit_published_posts')) {
14
  add_action( 'add_meta_boxes_post', array( __CLASS__, 'add_onesignal_post_options' ) );
15
  add_action( 'save_post', array( __CLASS__, 'on_post_save' ) );
16
  }
17
 
18
+ // Outside publish_posts check to catch posts that go from future to published in the background.
19
  add_action( 'transition_post_status', array( __CLASS__, 'notification_on_blog_post' ), 10, 3 );
20
 
21
  return $onesignal;
169
  $ch = curl_init();
170
  curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications");
171
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
172
+ 'Authorization: Basic ' . $onesignal_wp_settings['app_rest_api_key']));
173
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
174
  curl_setopt($ch, CURLOPT_HEADER, FALSE);
175
  curl_setopt($ch, CURLOPT_POST, TRUE);
onesignal.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: OneSignal Push Notifications
4
  * Plugin URI: https://onesignal.com/
5
  * Description:
6
- * Version: 1.0.4
7
  * Author: OneSignal
8
  * Author URI: https://onesignal.com
9
  * License: MIT
3
  * Plugin Name: OneSignal Push Notifications
4
  * Plugin URI: https://onesignal.com/
5
  * Description:
6
+ * Version: 1.0.5
7
  * Author: OneSignal
8
  * Author URI: https://onesignal.com
9
  * License: MIT
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://onesignal.com
4
  Tags: chrome, push, push notifications, safari, chrome push, safari push, notifications, web push, notification, notify, mavericks, firefox push, android, android push, android notifications, mobile notifications, mobile, desktop notifications, gcm, push messages, onesignal
5
  Requires at least: 3.8
6
  Tested up to: 4.3
7
- Stable tag: 1.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -46,6 +46,9 @@ Features:
46
 
47
  == Changelog ==
48
 
 
 
 
49
  = 1.0.4 =
50
  - Notifications sent with the Automatic Push Notifications on Post feature directly link to the post instead of the homepage when opening the notification.
51
  - Updated GCM instructions and added HTTP subscribe link/widget instructions on the Getting Started tab.
4
  Tags: chrome, push, push notifications, safari, chrome push, safari push, notifications, web push, notification, notify, mavericks, firefox push, android, android push, android notifications, mobile notifications, mobile, desktop notifications, gcm, push messages, onesignal
5
  Requires at least: 3.8
6
  Tested up to: 4.3
7
+ Stable tag: 1.0.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
46
 
47
  == Changelog ==
48
 
49
+ = 1.0.5 =
50
+ Send notification on post is now available to any Wordpress user with permissions to create or edit posts.
51
+
52
  = 1.0.4 =
53
  - Notifications sent with the Automatic Push Notifications on Post feature directly link to the post instead of the homepage when opening the notification.
54
  - Updated GCM instructions and added HTTP subscribe link/widget instructions on the Getting Started tab.