Advertisement:

Author Topic: Push Notifications  (Read 6488 times)

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,059
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #40 on: February 15, 2019, 10:30:49 AM »
Yeah it is based on member id thats how notifications gets sent to right person. I add member id as a filter from onesignal.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline addlife

  • Semi-Newbie
  • *
  • Posts: 61
Re: Push Notifications
« Reply #41 on: April 16, 2019, 04:37:53 AM »
Is it possible to have the button only displayed on a certain page? For example I would create a thread titled "Push Notifications" then on that page the button will show up.

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,059
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #42 on: April 16, 2019, 08:23:18 AM »
yes but you would have to change the logic for it.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline refx

  • Newbie
  • *
  • Posts: 5
Re: Push Notifications
« Reply #43 on: May 13, 2019, 02:01:59 PM »
Yeah it is based on member id thats how notifications gets sent to right person. I add member id as a filter from onesignal.

Hello,
I've installed the plugin, after copying .js files to root, it started working (before that I got 404 errors on onesignal panel). But I got many user reports who are unable to subscribe. When I check oneSignal users/allusers page, under tags column,  While I get couple of user id and uname correct, I see that there are multiple entries tagged "{uid: 0}" with different player ids. Also most of the tags are empty, totally blank tag information. App Version column is also completely blank.

Any ideas what's wrong with my installation?

Offline Christopher Scott Case

  • Newbie
  • *
  • Posts: 1
Re: Push Notifications
« Reply #44 on: August 09, 2019, 12:27:38 PM »
@vbgamer45 Hey, I've noticed that on replies to forum messages, I get notified when I reply to a topic I started, not just other people. It's annoying enough both myself and several of my users have decided not to use the notifications, because it's frustrating to get that extra notification.

If you can point me in the right direction, I'll gladly make the modification to filter out self replies myself. I was looking at the code, and I think I see where you're setting up a filter by user id, but as a JS dev with little PHP knowledge (and no SMF modding knowledge), I might not be following it correctly.

Offline Biology Forums

  • SMF Hero
  • ******
  • Posts: 3,779
    • StudyForcePS on Facebook
    • @studyforceps on Twitter
Re: Push Notifications
« Reply #45 on: August 09, 2019, 02:08:09 PM »
@vbgamer45 Hey, I've noticed that on replies to forum messages, I get notified when I reply to a topic I started, not just other people. It's annoying enough both myself and several of my users have decided not to use the notifications, because it's frustrating to get that extra notification.

If you can point me in the right direction, I'll gladly make the modification to filter out self replies myself. I was looking at the code, and I think I see where you're setting up a filter by user id, but as a JS dev with little PHP knowledge (and no SMF modding knowledge), I might not be following it correctly.

Let me get this straight, you start a topic, you reply to your topic, then you get notified (that's odd)
However, when others reply to your topic, you do not get notified (another oddity). Am I reading this correctly?

Offline grzeg8102

  • Newbie
  • *
  • Posts: 6
Re: Push Notifications
« Reply #46 on: September 17, 2019, 10:19:53 AM »
Hi vbgamer45!
First of all - great mod! SMF lacks such basic and common functionalities as web push, so this mod is really useful.

I wanted to report some bugs to you. They relate to the @mentions mod. There are a couple of issues - all related to the @mentions mod you provide support to:
1. mod installation file contains an error.
File 'webpush2.xml' contans:
Code: [Select]
<file name="$languagedir/Mentions.php" error="skip">should contain:
Code: [Select]
<file name="$sourcedir/Mentions.php" error="skip">This mistake basically adds no support for the mentions mod during installation of push notifications

2. There's a bug in the code to be modified inside Mentions.php resulting in a syntax error - HTTP 500 durin execution of the PHP code
File 'webpush2.xml' contans:
Code: [Select]
$pushurl = $scripturl . '?msg=" . $id_post];should contain:
Code: [Select]
$pushurl = $scripturl . '?msg=' . $id_post];
3. and the last bug in the code to be modified inside Mentions.php. There are no title nor message body parameters passed in callup of function webpush_send. The push notification when someone mentions the user is empty
File 'webpush2.xml' contans:
Code: [Select]
webpush_send($mention['id'], $user_info['id'], $user_info['name'],'tag',$pushurl);should contain:
Code: [Select]
webpush_send($mention['id'], $user_info['id'], $user_info['name'],'tag',$pushurl, array('message'=>$subject, 'title'=>''));

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,059
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #47 on: September 17, 2019, 10:39:07 AM »
Fixed and  updated! Thanks for the fixes

1.0.1 Fixed some bugs for mentions mod support thanks to grzeg8102
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline pocttopus

  • Full Member
  • ***
  • Posts: 489
  • Low pressure
    • @pocttopus on Twitter
    • mkreef.com
Re: Push Notifications
« Reply #48 on: September 20, 2019, 05:58:41 AM »
Hello,

This updated modification renames public_html/Sources/Mentions.php file and forum is going down.
I had no other option and I had to remove it somehow and reinstall @mentions mod again.

Offline stoneageman

  • Semi-Newbie
  • *
  • Posts: 25
Re: Push Notifications
« Reply #49 on: September 20, 2019, 06:47:53 AM »
Same issue with updated mod, breaks forum  :-X

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,059
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #50 on: September 20, 2019, 08:35:47 AM »
Hello,

This updated modification renames public_html/Sources/Mentions.php file and forum is going down.
I had no other option and I had to remove it somehow and reinstall @mentions mod again.
What do you mean by renames? How does it change?
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline stoneageman

  • Semi-Newbie
  • *
  • Posts: 25
Re: Push Notifications
« Reply #51 on: September 21, 2019, 03:54:09 AM »
I get the following error after installing. Running PHP7.1.30 SMF 2.0.15
Parse error: syntax error, unexpected 'id' (T_STRING) in */Sources/Mentions.php on line 256

Code: [Select]
webpush_send($mention['id'],$user_info['id'],$user_info['name'],'tag',$pushurl, array('message'=>$subject, 'title'=>''));
« Last Edit: September 21, 2019, 04:13:22 AM by stoneageman »

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,059
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #52 on: September 21, 2019, 09:36:03 AM »
Posted a new update to fix this issue.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline stoneageman

  • Semi-Newbie
  • *
  • Posts: 25
Re: Push Notifications
« Reply #53 on: September 21, 2019, 10:10:31 AM »
Installed with no errors. Thanks vbgamer45. Not had chance to test the bug fixes yet though.

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,059
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #54 on: July 29, 2020, 04:16:06 PM »
1.0.1a
+Added support for SMF 1.1.x
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline grzeg8102

  • Newbie
  • *
  • Posts: 6
Re: Push Notifications
« Reply #55 on: August 04, 2020, 10:28:34 AM »
Hi vbgamer,
I've spotted another small bug for push notifications. It bugged me for months why the website opened by push notifications shows the 1st page of a thread rather than navigating directly to the reply and today I found this.
Code: [Select]
<file name="$sourcedir/Subs-Post.php">

<operation>
<search position="replace"><![CDATA[trackStats(array('posts' => '+'));]]></search>
<add><![CDATA[trackStats(array('posts' => '+'));

// Push Notifications Mod SMFHacks.com
global $sourcedir, $scripturl;
require_once($sourcedir . '/webpush2.php');
$pushurl = $scripturl . '?topic=' . $topicOptions['id']. ".msg=" . $msgOptions['id'];
Last line contains a misformed parameter for the SMF forum, which the forum is unable to understand and opens the 1st page. The last line should look like this:
Code: [Select]
$pushurl = $scripturl . '?topic=' . $topicOptions['id']. ".msg" . $msgOptions['id'] . '.html#msg' . $msgOptions['id'];So basically no `=` sign is necessary for the msg id. This makes the forum to navigate to the biginning of the right page with the last reply. However ideally we'd love to see the reply content from the push notification, right? And that's why we need to use the anchor in the link, so `#msgXXXX`.
After that the link is formatted correctly enough to be interpreted correctly bo SMF and opens the right URL with the reply.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Push Notifications
« Reply #56 on: August 04, 2020, 10:35:00 AM »
Um. You're both kind of wrong :/

The correct line would actually be:
Code: [Select]
$pushurl = $scripturl . '?topic=' . $topicOptions['id']. ".msg" . $msgOptions['id'] . "#msg" . $msgOptions['id'];
Any use of '.html' in SMF URLs is only valid for queryless URLs which is not the default, not used throughout the rest of SMF and only implemented as a last-minute replacement in the buffer (i.e. almost none of SMF actually outputs .html URLs, it outputs the URLs of the format I outlined and is converted *only* if that option is turned on, last minute before sending the page to the browser.

And of no benefit to modern search engines.
No good deed goes unpunished
All helpful urges should be circumvented

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,059
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #57 on: August 04, 2020, 10:39:15 AM »
I think I had an issue sending the # which I why I took it I could be wrong though don't remember. Give it a try though and let me know.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Push Notifications
« Reply #58 on: August 04, 2020, 10:47:49 AM »
Even if you have no # in it, you need to not have .msg= in the URL but .msg123 as that’s what SMF picks up.
No good deed goes unpunished
All helpful urges should be circumvented

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,059
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #59 on: August 04, 2020, 11:35:54 AM »
Update
1.0.1b
!Minor url for forum posts fix thanks to Arantor.



Note didn't add the # in the url
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro