Resource icon

XenForo OneSignal Push Notifications - Now With Simple Install 1.1.11.2

No permission to download

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
Screenshot_20170426-081902.png

Ok so they must provide an endpoint URL for you.

This would require you to record the onesignal user id.

Maybe they could develop a method that allows tagging? There is a lot of powerful reasons to use tagging....
 
Joined
Apr 29, 2011
Messages
566
I will ask them. But in the meanwhile does it mean that your addon and their method wouldn't be expected to work together? And if they use tagging, would it work?
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
I don't store or use any SQL for performance reasons. Unless it's a single select statement in batch.

I tag users as uid:1 for example. You'll see it in the html source the set of tags used.

Thus the call to onesignal is if uid equal 1 send message so it's remarkably simple. Don't need to figure the users unique I'd that onesignal assigns them.

If the app could read some sort of data structure from the html that would allow you to tag the user that would be awesome.
 
Joined
Apr 29, 2011
Messages
566
Thanks, unfortunately this is all over my head. I'm just going to assume that as presently constructed, their app and your addon don't talk to one another and that therefore that app isn't going to do notifications. Still better than nothing!
 

R0binHood

Habitué
Joined
Nov 23, 2011
Messages
1,606
So I got a response from OneSignal, Jason there was incredibly helpful. Here's what he said:

Hey there,
We're familiar with this plugin using that GCM Sender ID.
Please go back to the options page on your site and switch the GCM Sender ID back to the 380.... that was shown in the screenshot. Please do this as soon as possible, since new users who sign up in the meantime will not be able to receive notifications permanently.
We've modified your dashboard to set the correct Server API Key for the 380.... GCM Sender ID your site is using.
----
Normally, new sites are not supposed to use a custom GCM Sender ID. You weren't aware of this since you were using the forum plugin. Could you please provide a link to the plugin? We'd love to get in touch with the author to suggest ways we can contribute an update to the plugin.

So as a summary:
Please go back to your site's settings (on your site, on that plugin) to set the GCM Sender ID back to 380462037497.
We've updated your app's settings so your users should be able to receive notifications now.
One of your users is Mismatched (Invalid) and won't be able to receive notifications permanently, along with any users who sign up while the GCM Sender ID on your site's plugin is 482941778795.

Aside from updating your site's settings there's nothing else you need to do!

Also make sure the GCM Sender ID doesn't change in the future.

So it looks like I only effed up switching back to the 482... code for a few hours yesterday when someone new signed up on the wrong ID. I've asked him if there's a way for me to identifiy this user so I can get in contact personally to try and fix their subscription.

Since they updated the GCM ID in my dashboard on their end I've started to receive Chrome notifications again!

I've pointed him in the direction of this thread so hopefully they can work a bit more closely with Pierce and the rest of the community to make the integration a bit more solid.
 

R0binHood

Habitué
Joined
Nov 23, 2011
Messages
1,606
So two months on, what are the stats looking like for any big boards using this?

% of users using it?
Noticeable increase in activity and re-engagement?
Comments, feedback or complaints from users?
 
Joined
Apr 29, 2011
Messages
566
Is GCM the same as Google Project Number? My apps are set up to use a Google Project Number which is different than the GCM in the addon. Would that be the issue?
 

R0binHood

Habitué
Joined
Nov 23, 2011
Messages
1,606
I'm not sure exactly.

I spoke with Jason at OneSignal and they are going to get in contact with Pierce to hopefully collaborate and work together to figure out how we're using the product and enhance the add on.

They're also going to verify the GCM sender ID default details with the add on to make sure it's all correct going forward.
 

David XLD

Aspirant
Joined
Apr 27, 2017
Messages
22
Hi,

I love it, thank you very much for sharing!!

Unfortunately it seems that several options in the admin side are not working:
Position Right or Left : I have changed to left but the bell is still to the right
I have changed all the texts in order to put them in french but unfortunately they are still at their initial value.
Do you encounter the same issues?

Thanks

David
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
I'm not sure exactly.

I spoke with Jason at OneSignal and they are going to get in contact with Pierce to hopefully collaborate and work together to figure out how we're using the product and enhance the add on.

They're also going to verify the GCM sender ID default details with the add on to make sure it's all correct going forward.
Ironically I am an enterprise user.

I also declared the add-on in the paperwork..
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
Did you copy and paste code in?

Did you enable it in permissions? For the user groups registered and unregistered/guest?
 

David XLD

Aspirant
Joined
Apr 27, 2017
Messages
22
Hi,

Yes I have enabled the plugin in permissions.
What do you mean by
"Did you copy and paste code in?"

Thanks

David
 

David XLD

Aspirant
Joined
Apr 27, 2017
Messages
22
Hi Pierce,

Thanks again for your help, now the setup of the options works correctly.
I encounter a strange issue for 3 days regarding the users subscribtions.
In the OneSignal admin panel, I see no more users subsribtions coming from Google Chrome or Android, I have subscribtions coming from Firefox only.
It is not possible because I do some subscribtions tests on my own from Chrome and I can subscribed and unsubscribed correctly.
But there are no information about that in the OneSignal "All Users" menu.

Strange...

Have a nice day!

David
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
pierce updated Xenforo OneSignal Push Notifications - Now With Simple Install with a new update entry:

Updated GCM id and a few other things

We now have options for persistent notices in chrome as requested by Mouth

and we have non https subdomain requirement. Keeping it 0 (or false for anybody using https!)

You will see some stuff with like text, which is the start of my adventure into changing text for notices. It should work for that one alert but still not sure how to proceed on this item.

Read the rest of this update entry...
 

R0binHood

Habitué
Joined
Nov 23, 2011
Messages
1,606
Thanks for the update Pierce :)

One thing I noticed on facebook the other day is that when I get messenger chat notifications it shows me the profile photo of the user that messaged me in the push notification.

It would be cool if when you get xenforo conversation alerts, it uses the avatar of the user, instead of the site logo.
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
Yeah I've though of this and can't see how to make it work in xf2.

In xf 1 I think the profile pics are static and easy to find.

Also gets complicated with gravitar support
 

R0binHood

Habitué
Joined
Nov 23, 2011
Messages
1,606
Cool, it's just a thought.

Chris D might be able to point you in the right direction with regards to how to implement it XF2 when the time comes.
 

Mouth

Enthusiast
Joined
Oct 3, 2009
Messages
199
Yeah I've though of this and can't see how to make it work in xf2.

In xf 1 I think the profile pics are static and easy to find.

Also gets complicated with gravitar support
Another add-ons overcomes this. It places a file in the root of your XF called /avatar.php ....

PHP:
<?php

$startTime = microtime(true);
$fileDir = dirname(__FILE__);

require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');

XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);

####################



// GET DB
$db = XenForo_Application::get('db');

// ASSIGN GET PARAMETERS
$userid = (!empty($_GET['userid']) ? intval($_GET['userid']) : false);
$username = (!empty($_GET['username']) ? $_GET['username'] : false);
$size = (!empty($_GET['size']) ? $_GET['size'] : false);

// ENFORCE VALUES FOR SIZE, AND SET DEFAULT 'm'
$size = (in_array($size, array('s','m','l')) ? $size : 'm');



// GET USER BY USERID
if ($userid)
{
        $user = $db->fetchRow("
                SELECT *
                FROM xf_user
                WHERE user_id = ?
        ", $userid);
}
// ELSE GET USER BY USERNAME
else if ($username)
{
        $user = $db->fetchRow("
                SELECT *
                FROM xf_user
                WHERE username = ?
        ", $username);
}



// USER NOT FOUND, OUTPUT DEFAULT NO GENDER
if (empty($user['user_id']))
{
        $file = "./styles/default/xenforo/avatars/avatar_{$size}.png";
        $type = 'image/png';
        header('Content-Type:'.$type);
        header('Content-Length: ' . filesize($file));
        readfile($file);

        exit(0);
}



// GRAVATARS
if ($user['gravatar'])
{
        $avaurl = XenForo_Template_Helper_Core::getAvatarUrl($user, $size);

        $file = $avaurl;
        $filecontents = file_get_contents($file);
        $type = 'image/jpeg';
        header('Content-Type:'.$type);
        header('Content-Length: ' . strlen($filecontents));
        echo $filecontents;

        exit(0);
}



// CUSTOM AVATARS
if (!empty($user['avatar_date']))
{
// https://xenforo.com/community/threads/avatar-php.30739/page-2#post-892524
//      $avaurl = XenForo_Template_Helper_Core::getAvatarUrl($user, $size, 'custom');

        $group = floor($user['user_id'] / 1000);
        $avaurl = "data" . "/avatars/$size/$group/$user[user_id].jpg?$user[avatar_date]";

        $file = './' . substr($avaurl, 0, strpos($avaurl, '?'));
        $type = 'image/jpeg';
        header('Content-Type:'.$type);
        header('Content-Length: ' . filesize($file));
        readfile($file);

        exit(0);
}



// DEFAULT AVATARS
if (true)
{
        $avaurl = XenForo_Template_Helper_Core::getAvatarUrl($user, $size, 'default');

        $file = './' . $avaurl;
        $type = 'image/png';
        header('Content-Type:'.$type);
        header('Content-Length: ' . filesize($file));
        readfile($file);

        exit(0);
}
 
Top