Resource icon

XenForo Xenforo OneSignal Push Notifications - Now With Simple Install

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:

Made a fix in onesignal_js

On the set of code for guests:

This line:

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

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 :)

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

 $url = "".$mid['title'].".".$mid['conversation_id']."/#message-".$mid['last_message_id'];


$url = "".$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:
case "edit":
 $content_response = $username . " edited your post";
And add after it so it looks like this:

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

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