Version Description
- Fixed bug where some plugins that create posts were not sending out a OneSignal notifications automatically when 'All Posts created from other plugins' was enabled.
- Fixed errors that display when 'WP_DEBUG' is set to true
Download this release
Release Info
Developer | OneSignal |
Plugin | OneSignal – Free Web Push Notifications |
Version | 1.0.7 |
Comparing to | |
See all releases |
Code changes from version 1.0.6 to 1.0.7
- onesignal-admin.php +8 -28
- onesignal-public.php +1 -2
- onesignal-settings.php +1 -1
- onesignal.php +1 -1
- readme.txt +4 -1
- views/config.php +5 -9
onesignal-admin.php
CHANGED
@@ -6,12 +6,11 @@ class OneSignal_Admin {
|
|
6 |
|
7 |
public static function init() {
|
8 |
$onesignal = new self();
|
9 |
-
if(current_user_can('update_plugins')) {
|
10 |
add_action( 'admin_menu', array(__CLASS__, 'add_admin_page') );
|
11 |
}
|
12 |
-
if(current_user_can('publish_posts') || current_user_can('edit_published_posts')) {
|
13 |
add_action( 'add_meta_boxes_post', array( __CLASS__, 'add_onesignal_post_options' ) );
|
14 |
-
add_action( 'save_post', array( __CLASS__, 'on_post_save' ) );
|
15 |
}
|
16 |
|
17 |
add_action( 'transition_post_status', array( __CLASS__, 'on_transition_post_status' ), 10, 3 );
|
@@ -28,19 +27,10 @@ class OneSignal_Admin {
|
|
28 |
'high');
|
29 |
}
|
30 |
|
31 |
-
public static function on_post_save($post_id) {
|
32 |
-
if ( $_POST['send_onesignal_notification'] === "true" && get_post_status($post_id) !== "publish" ) {
|
33 |
-
update_post_meta($post_id, 'send_onesignal_notification', "true");
|
34 |
-
}
|
35 |
-
else {
|
36 |
-
update_post_meta($post_id, 'send_onesignal_notification', "false");
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
public static function onesignal_notif_on_post_html_view($post) {
|
41 |
$onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
42 |
?>
|
43 |
-
<input type="checkbox" name="send_onesignal_notification" value="true" <?php if ($onesignal_wp_settings['notification_on_post'] && $post->post_status != "publish") { echo checked; } ?>></input>
|
44 |
<input type="hidden" name="has_onesignal_setting" value="true"></input>
|
45 |
<label> <?php if ($post->post_status == "publish") { echo "Send notification on update"; } else { echo "Send notification on publish"; } ?></label>
|
46 |
<?php
|
@@ -72,31 +62,27 @@ class OneSignal_Admin {
|
|
72 |
$onesignal_wp_settings['subdomain'] = $config['subdomain'];
|
73 |
}
|
74 |
|
75 |
-
if (
|
76 |
$onesignal_wp_settings['auto_register'] = true;
|
77 |
}
|
78 |
else {
|
79 |
$onesignal_wp_settings['auto_register'] = false;
|
80 |
}
|
81 |
|
82 |
-
if (
|
83 |
$onesignal_wp_settings['notification_on_post'] = true;
|
84 |
}
|
85 |
else {
|
86 |
$onesignal_wp_settings['notification_on_post'] = false;
|
87 |
}
|
88 |
|
89 |
-
if (
|
90 |
$onesignal_wp_settings['notification_on_post_from_plugin'] = true;
|
91 |
}
|
92 |
else {
|
93 |
$onesignal_wp_settings['notification_on_post_from_plugin'] = false;
|
94 |
}
|
95 |
|
96 |
-
$onesignal_wp_settings['default_title'] = $config['default_title'];
|
97 |
-
$onesignal_wp_settings['default_icon'] = $config['default_icon'];
|
98 |
-
$onesignal_wp_settings['default_url'] = $config['default_url'];
|
99 |
-
|
100 |
$onesignal_wp_settings['app_rest_api_key'] = $config['app_rest_api_key'];
|
101 |
|
102 |
OneSignal::save_onesignal_settings($onesignal_wp_settings);
|
@@ -144,14 +130,8 @@ class OneSignal_Admin {
|
|
144 |
if (isset($_POST['has_onesignal_setting'])) {
|
145 |
$send_onesignal_notification = $_POST['send_onesignal_notification'];
|
146 |
}
|
147 |
-
|
148 |
-
$
|
149 |
-
if (empty($isOneSignalPostMeta)) {
|
150 |
-
$send_onesignal_notification = $isOneSignalPostMeta;
|
151 |
-
}
|
152 |
-
elseif ($old_status !== "publish") {
|
153 |
-
$send_onesignal_notification = $onesignal_wp_settings['notification_on_post_from_plugin'];
|
154 |
-
}
|
155 |
}
|
156 |
|
157 |
if ($send_onesignal_notification === true || $send_onesignal_notification === "true") {
|
6 |
|
7 |
public static function init() {
|
8 |
$onesignal = new self();
|
9 |
+
if (current_user_can('update_plugins')) {
|
10 |
add_action( 'admin_menu', array(__CLASS__, 'add_admin_page') );
|
11 |
}
|
12 |
+
if (current_user_can('publish_posts') || current_user_can('edit_published_posts')) {
|
13 |
add_action( 'add_meta_boxes_post', array( __CLASS__, 'add_onesignal_post_options' ) );
|
|
|
14 |
}
|
15 |
|
16 |
add_action( 'transition_post_status', array( __CLASS__, 'on_transition_post_status' ), 10, 3 );
|
27 |
'high');
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
public static function onesignal_notif_on_post_html_view($post) {
|
31 |
$onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
32 |
?>
|
33 |
+
<input type="checkbox" name="send_onesignal_notification" value="true" <?php if ($onesignal_wp_settings['notification_on_post'] && $post->post_status != "publish") { echo "checked"; } ?>></input>
|
34 |
<input type="hidden" name="has_onesignal_setting" value="true"></input>
|
35 |
<label> <?php if ($post->post_status == "publish") { echo "Send notification on update"; } else { echo "Send notification on publish"; } ?></label>
|
36 |
<?php
|
62 |
$onesignal_wp_settings['subdomain'] = $config['subdomain'];
|
63 |
}
|
64 |
|
65 |
+
if (@$config['auto_register'] == "true") {
|
66 |
$onesignal_wp_settings['auto_register'] = true;
|
67 |
}
|
68 |
else {
|
69 |
$onesignal_wp_settings['auto_register'] = false;
|
70 |
}
|
71 |
|
72 |
+
if (@$config['notification_on_post'] == "true") {
|
73 |
$onesignal_wp_settings['notification_on_post'] = true;
|
74 |
}
|
75 |
else {
|
76 |
$onesignal_wp_settings['notification_on_post'] = false;
|
77 |
}
|
78 |
|
79 |
+
if (@$config['notification_on_post_from_plugin'] == "true") {
|
80 |
$onesignal_wp_settings['notification_on_post_from_plugin'] = true;
|
81 |
}
|
82 |
else {
|
83 |
$onesignal_wp_settings['notification_on_post_from_plugin'] = false;
|
84 |
}
|
85 |
|
|
|
|
|
|
|
|
|
86 |
$onesignal_wp_settings['app_rest_api_key'] = $config['app_rest_api_key'];
|
87 |
|
88 |
OneSignal::save_onesignal_settings($onesignal_wp_settings);
|
130 |
if (isset($_POST['has_onesignal_setting'])) {
|
131 |
$send_onesignal_notification = $_POST['send_onesignal_notification'];
|
132 |
}
|
133 |
+
elseif ($old_status !== "publish") {
|
134 |
+
$send_onesignal_notification = $onesignal_wp_settings['notification_on_post_from_plugin'];
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
|
137 |
if ($send_onesignal_notification === true || $send_onesignal_notification === "true") {
|
onesignal-public.php
CHANGED
@@ -5,8 +5,7 @@ class OneSignal_Public {
|
|
5 |
public function __construct() {}
|
6 |
|
7 |
public static function init() {
|
8 |
-
|
9 |
-
add_action( 'wp_head', array( __CLASS__, 'onesignal_header' ), 1 );
|
10 |
}
|
11 |
|
12 |
public static function onesignal_header() {
|
5 |
public function __construct() {}
|
6 |
|
7 |
public static function init() {
|
8 |
+
add_action( 'wp_head', array( __CLASS__, 'onesignal_header' ), 1 );
|
|
|
9 |
}
|
10 |
|
11 |
public static function onesignal_header() {
|
onesignal-settings.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
class OneSignal {
|
3 |
public static function get_onesignal_settings() {
|
4 |
-
if (!
|
5 |
$onesignal_wp_settings = get_option("OneSignalWPSetting");
|
6 |
if (empty( $onesignal_wp_settings )) {
|
7 |
$onesignal_wp_settings = array(
|
1 |
<?php
|
2 |
class OneSignal {
|
3 |
public static function get_onesignal_settings() {
|
4 |
+
if (!isset($onesignal_wp_settings)) {
|
5 |
$onesignal_wp_settings = get_option("OneSignalWPSetting");
|
6 |
if (empty( $onesignal_wp_settings )) {
|
7 |
$onesignal_wp_settings = array(
|
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.
|
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.7
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -45,6 +45,9 @@ Features:
|
|
45 |
3. Follow the instructions on the new OneSignal Wordpress menu option to get started.
|
46 |
|
47 |
== Changelog ==
|
|
|
|
|
|
|
48 |
|
49 |
= 1.0.6 =
|
50 |
- Added Automatic Push Notifications option for 'All Posts created from other plugins' on the "Notification Settings" 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.7
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
45 |
3. Follow the instructions on the new OneSignal Wordpress menu option to get started.
|
46 |
|
47 |
== Changelog ==
|
48 |
+
= 1.0.7 =
|
49 |
+
- Fixed bug where some plugins that create posts were not sending out a OneSignal notifications automatically when 'All Posts created from other plugins' was enabled.
|
50 |
+
- Fixed errors that display when 'WP_DEBUG' is set to true
|
51 |
|
52 |
= 1.0.6 =
|
53 |
- Added Automatic Push Notifications option for 'All Posts created from other plugins' on the "Notification Settings" tab.
|
views/config.php
CHANGED
@@ -1,11 +1,7 @@
|
|
1 |
<?php
|
2 |
$onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
3 |
-
|
4 |
-
|
5 |
-
echo "<br/>";
|
6 |
-
echo var_dump($onesignal_wp_settings);
|
7 |
-
*/
|
8 |
-
if ($_POST['app_id']) {
|
9 |
$onesignal_wp_settings = OneSignal_Admin::save_config_page($_POST);
|
10 |
}
|
11 |
?>
|
@@ -267,7 +263,7 @@ if ($_POST['app_id']) {
|
|
267 |
</div>
|
268 |
|
269 |
<div class="col-md-9">
|
270 |
-
<input type="checkbox" name="notification_on_post" value="true" <?php if ($onesignal_wp_settings['notification_on_post']) { echo checked; } ?>></input>
|
271 |
<p> Post from default Wordpress creator.</p><br/>
|
272 |
<p style="font-style:italic; font-size:10pt">(You can change this setting per post before you publish.)</p>
|
273 |
</div>
|
@@ -275,7 +271,7 @@ if ($_POST['app_id']) {
|
|
275 |
<div class="col-md-3">
|
276 |
</div>
|
277 |
<div class="col-md-9">
|
278 |
-
<input type="checkbox" name="notification_on_post_from_plugin" value="true" <?php if ($onesignal_wp_settings['notification_on_post_from_plugin']) { echo checked; } ?>></input>
|
279 |
<p> All Posts created from other plugins. </p>
|
280 |
</div>
|
281 |
</div>
|
@@ -307,7 +303,7 @@ if ($_POST['app_id']) {
|
|
307 |
|
308 |
<div class="col-md-9">
|
309 |
|
310 |
-
<!--<input type="checkbox" name="add-widget" value="true" <?php if ($onesignal_wp_settings['auto_register']) { echo checked; } ?>></input>-->
|
311 |
<p> <strong> Option 1: </strong> Search for and install the OneSignal widget, allowing users to receive notifications from your site. </p>
|
312 |
|
313 |
<br/></br/>
|
1 |
<?php
|
2 |
$onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
3 |
+
|
4 |
+
if (array_key_exists('app_id', $_POST)) {
|
|
|
|
|
|
|
|
|
5 |
$onesignal_wp_settings = OneSignal_Admin::save_config_page($_POST);
|
6 |
}
|
7 |
?>
|
263 |
</div>
|
264 |
|
265 |
<div class="col-md-9">
|
266 |
+
<input type="checkbox" name="notification_on_post" value="true" <?php if ($onesignal_wp_settings['notification_on_post']) { echo "checked"; } ?>></input>
|
267 |
<p> Post from default Wordpress creator.</p><br/>
|
268 |
<p style="font-style:italic; font-size:10pt">(You can change this setting per post before you publish.)</p>
|
269 |
</div>
|
271 |
<div class="col-md-3">
|
272 |
</div>
|
273 |
<div class="col-md-9">
|
274 |
+
<input type="checkbox" name="notification_on_post_from_plugin" value="true" <?php if ($onesignal_wp_settings['notification_on_post_from_plugin']) { echo "checked"; } ?>></input>
|
275 |
<p> All Posts created from other plugins. </p>
|
276 |
</div>
|
277 |
</div>
|
303 |
|
304 |
<div class="col-md-9">
|
305 |
|
306 |
+
<!--<input type="checkbox" name="add-widget" value="true" <?php if ($onesignal_wp_settings['auto_register']) { echo "checked"; } ?>></input>-->
|
307 |
<p> <strong> Option 1: </strong> Search for and install the OneSignal widget, allowing users to receive notifications from your site. </p>
|
308 |
|
309 |
<br/></br/>
|