Resource icon

XenForo Xenforo OneSignal Push Notifications - Now With Simple Install 1.1.11.2

No permission to download
Thanks to xfrocks RoldanLT

$extra_data should be $extraData in Alerts.php
quick fix by RoldanLT

for conversations

instead of doing conversations/asdf.MESSAGE_ID

it is now conversations/MESSAGE_ID
  • Like
Reactions: Dan18
manifest.json - is now onesignal_manifest template for easier updating

You can now customize a whole plethora of options. - button customizing, hiding the button after subscribing, button size, color etc.

Permissions - you must allow for Guest and Registered Member to return it back to the way it was other wise you can test on a per usergroup basis (search for OneSignal in the usergroup permissions)

This is a massive update so please report bugs and i will try to fix as soon as I can.

post changed to posts reported by RoldanLT
  • Like
Reactions: R0binHood and Dan18
Capital D on $contentId on the case condition "tag" in Alerts.php
  • Like
Reactions: Shin Ryoku
Bug fix on conversations.

During the conversion to make it configurable in the xenforo control panel, the i cut /conversations from the url in Conversations.php.

Thank you mysiteguy
  • Like
Reactions: Shin Ryoku
Removed onesignal SDK files from the upload directory and separated them to show that they need a bit more attention.

OneSignal Documentation is here:
https://documentation.onesignal.com/docs/web-push-sdk-setup-https

Made a fix in onesignal_js

On the set of code for guests:

This line:

Code:
OneSignal.push(["sendTags", {uid: "{$visitor.user_id}", uname: "{$visitor.username}", lastnode: "{$forum.node_id}"}, function(){}]);

is missing: {$forum.node_id} from lastnode: "" (in version 1.05).

Which allows re-targeting of notices by last forum that they were in.
  • Like
Reactions: Shin Ryoku
upload_2017-2-20_23-21-34.png


Ok, so I decided how to figure out to make it easier to roll out for everybody. Less "clunky".

You now have OneSignal Push Notifications options in your control panel.

Its very slick now... if I dont say so myself! :D

When updating merge the parent template and edit the options above.

Only file edit now required is "manifest.json" which there is nothing I can do about :)

Enjoy
To update quickly on a live site find the following line(83 on Conversation.php):

Code:
 $url = "https://my_domain.com/conversations/".$mid['title'].".".$mid['conversation_id']."/#message-".$mid['last_message_id'];

with:

Code:
$url = "https://my_domain.com/conversations/asdf.".$mid['conversation_id']."/#message-".$mid['last_message_id'];

Update your domain as appropriately.

XF will still redirect the link because it redirects on the ID. I have always liked XF for its internal URL system. However I remember writing this and thinking I was possibly being a bit too fancy... oh well.

A very warm thank you to mysiteguy for reporting the bug.
I noticed I was missing tag alert on one site which has been added to Alert.php

If you have already installed the script, the faster way is to find in Alert.php, around line 71:
Code:
case "edit":
 $content_response = $username . " edited your post";
 break;
And add after it so it looks like this:

Code:
case "edit":
 $content_response = $username . " edited your post";
 break;

case "tag":
 $url .= "post/" . $contentID ."?utm_source=onesignal&utm_medium=alert&utm_campaign=onesignal";
 $content_response = "You were tagged in a post by " . $username;
 break;
Top