vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Integration with vBulletin - Web Push notifications using OneSignal (https://vborg.vbsupport.ru/showthread.php?t=326558)

iA1 07-10-2018 09:00 PM

Web Push notifications using OneSignal
 
1 Attachment(s)
Description:

OneSignal has an API that allows us to send unlimited web and push notifications for FREE. When I came to know about it, I spent several days and months searching for compatible plugins for vB4. Finally decided to learn and create my own based on pierce's similar mod for Xenforo.

Push notifications is a great way to keep your members engaged. It keeps driving them back to your site. This mod works great on mobile browsers as well.

This is the lite version which allows you to send web push notifications to your users whenever:
  1. someone replies on their subscribed threads
  2. sends them a PM
  3. likes one of their posts (dbtech thanks)

Installation:
  1. Register an account at OneSignal.com
    • Click on Add a new app to register your forum there
    • Select Web Push as the platform
      https://vborg.vbsupport.ru/external/2018/07/4.png
    • Configure Web Push by selecting Typical Site and enter you forum details
      https://vborg.vbsupport.ru/external/2018/07/5.png
    • Add at least one prompt and complete the remaining setup there. Leave most of the options as default. Only change where necessary.
    • After you click Save, you will get a few files to download.
      https://vborg.vbsupport.ru/external/2018/07/6.png
    • Download those files, extract them and upload them to your forum's root directory.
    • There is another section on the same page asking you to add code to your site. DO NOT add that code yet. It is automatically done when you install this product.
  2. Download attached zip file. Upload the file functions_OneSignal.php under /includes directory
  3. Install the product using the xml file
  4. Go back to onesignal.com, under settings, click on Keys & IDs.
    https://vborg.vbsupport.ru/external/2018/07/7.png
  5. Copy these keys and paste them in the settings in admincp.
    https://vborg.vbsupport.ru/external/2018/07/8.png


Disclaimer:
I am not associated with onesignal in any way. This is just something that I found useful for my forum and wanted to share with everyone else.

If I get enough support then I plan to add notifications for moderators' actions and for quotes and tags as well.


Download latest version: 1.3.5
If upgrading from previous version, replace the functions file as well.

Change log:
1.3.5 - Typo fixed
1.3.0 - Separated multiple consecutive notifications for different threads
1.2.0 - Added privacy for replies in private sections and
Subscribe button at the end of posts
1.1.0 - Fixed issue with sub-forum
1.0.1 - Fixed Table Prefix bug
1.0.0 - Initial Release

iA1 07-11-2018 12:39 PM

Screenshots:


Demo on vB4Mobile.com and IslamicBoard.com

scottkoz20 07-11-2018 03:46 PM

This looks extremely interesting

iA1 07-11-2018 05:09 PM

Quote:

Originally Posted by scottkoz20 (Post 2595494)
This looks extremely interesting

Glad you liked it. Screenshots are added in the above post.

scottkoz20 07-11-2018 05:54 PM

something that I noticed is that the server load spikes when this is active - testing more

iA1 07-11-2018 05:58 PM

Quote:

Originally Posted by scottkoz20 (Post 2595498)
something that I noticed is that the server load spikes when this is active - testing more

How big is your forum and how many users are active simultaneously?

IggyP 07-12-2018 02:14 PM

looking forward to testing this, not sure when i will be able to, but the other mod like this i tried had some fatal conflicts somewhere with other mods or whatever i was using.

scottkoz20 07-13-2018 10:11 PM

Quote:

Originally Posted by scottkoz20 (Post 2595498)
something that I noticed is that the server load spikes when this is active - testing more

i can't say with certainty that my load spike is your mod. I'll watch it though

carik 09-15-2018 12:41 PM

Good afternoon.
I installed the mod, did everything according to the instructions, notifications come only from the themes of one forum, from other forums it comes only to e-mail. What could be the problem? Thank you!

carik 09-15-2018 01:08 PM

sends notifications only from the topic, in English. Of those in the Russian language does not send. How to solve a problem? Thank you!

carik 09-15-2018 01:26 PM

Even if the topic name in English, and the text of the response in Russian, the notification is not sent.

iA1 09-15-2018 05:54 PM

Quote:

Originally Posted by carik (Post 2596364)
sends notifications only from the topic, in English. Of those in the Russian language does not send. How to solve a problem? Thank you!

I am not sure why it doesn't work for Russian. Can you check your OneSignal control panel for message logs and see if there is any error listed there?

I have tested this with another language and it worked fine for me without any issues.

carik 09-15-2018 06:03 PM

Quote:

Originally Posted by iA1 (Post 2596366)
I am not sure why it doesn't work for Russian. Can you check your OneSignal control panel for message logs and see if there is any error listed there?

I have tested this with another language and it worked fine for me without any issues.

thanks for the answer.
if I send test messages from the OneSign panel, there are no errors. When I create a topic on the forum, the name in English, I write in it in English, there are no problems, push message comes. I think that the error with the processing of php mod ... or the encoding does not understand. I do not see any errors in the logs. And I tried to translate phrases in a php file, for example, "replied to", immediately ceases to send push messages.

carik 09-15-2018 06:25 PM

and perhaps when sending push to convert the encoding cp1251 to utf-8? I see that the problem is this. Thank you.

carik 09-17-2018 01:22 PM

Quote:

Originally Posted by iA1 (Post 2596366)
I am not sure why it doesn't work for Russian. Can you check your OneSignal control panel for message logs and see if there is any error listed there?

I have tested this with another language and it worked fine for me without any issues.

And can I make it so that a notification without nicknames, topic names and messages is sent? The usual notification is a "new answer", or "a new personal message". And click on the link to send a link to a topic or personal message.
That would be the right decision! Moreover, I have a very small notice on the 27 "screen, and it's easier for me to click and read on the site." It's also more convenient for me to follow the link on a mobile phone.

Cable_Player 09-17-2018 04:50 PM

Hi, I've followed your instructions exactly, but notifications to subscribe are not showing.
I'm just running a test board at the moment to see the capabilities of the software and it is located at
Code:

https://www.mydomain.com/forum
In the settings on OneSignal it does not allow me to enter that location, only
Code:

https://www.mydomain.com
- could this be the reason it isn't showing?
Thanks.


Update:
Sorry I was being impatient. It's showing now, but as my connection is private it's blocking notifications. I'll see how it runs for other people though, thanks for providing this plugin.

iA1 09-17-2018 07:35 PM

1 Attachment(s)
Quote:

Originally Posted by carik (Post 2596398)
And can I make it so that a notification without nicknames, topic names and messages is sent? The usual notification is a "new answer", or "a new personal message". And click on the link to send a link to a topic or personal message.
That would be the right decision! Moreover, I have a very small notice on the 27 "screen, and it's easier for me to click and read on the site." It's also more convenient for me to follow the link on a mobile phone.

Replace the file includes/functions_OneSignal.php with the attached file. You can even open that file in a text editor and modify the messages as you like.

carik 09-18-2018 04:14 PM

Quote:

Originally Posted by iA1 (Post 2596402)
Replace the file includes/functions_OneSignal.php with the attached file. You can even open that file in a text editor and modify the messages as you like.

:up: Yes! working!!!
PM removed from the code?
I change the text in the script if the English language works, if the Russian text does not send messages. I do not understand the problem.

and the transition from push notification to the wrong place where the new answer, but simply to the home page.

iA1 09-18-2018 04:27 PM

Quote:

Originally Posted by carik (Post 2596411)
:up: Yes! working!!!
PM removed from the code?
I change the text in the script if the English language works, if the Russian text does not send messages. I do not understand the problem.

No, PM is not removed. It is there at line # 51.

carik 09-18-2018 04:32 PM

<a href="https://www.carhelp.info/showthread.php?p=1544887&utm_source=onesignal&utm_ medium=push&utm_campaign=onesignal" target="_blank">https://www.carhelp.info/showthread....aign=onesignal</a> Here such link comes in push, I think the end superfluous?

carik 09-18-2018 04:41 PM

Quote:

Originally Posted by iA1 (Post 2596412)
No, PM is not removed. It is there at line # 51.

ok!


and this is a link where you had to switch by click to push.
https://www.carhelp.info/forums/show...87#post1544887

z3r0 09-18-2018 06:43 PM

If you are using this you may want to take a look here - https://xenforo.com/community/thread...e-this.153212/

IMO there are GDPR implications.

carik 09-19-2018 09:18 AM

Quote:

Originally Posted by iA1 (Post 2596412)
No, PM is not removed. It is there at line # 51.

in the delivery report in onesignal if you look there writes here such
Filters {"key":"uid","field":"tag","value":"10234362","rel ation":"="}
all links in notifications have the wrong view. How to fix it? Thank you!

carik 09-19-2018 09:19 AM

Quote:

Originally Posted by z3r0 (Post 2596415)
If you are using this you may want to take a look here - https://xenforo.com/community/thread...e-this.153212/

IMO there are GDPR implications.

your mobile phone transmits a lot more personal data.

carik 09-19-2018 09:24 AM

Quote:

Originally Posted by iA1 (Post 2596412)
No, PM is not removed. It is there at line # 51.

in the settings of the service configured not to open in a new tab, but to switch to the tab if it is open in the browser. still open a new tab. I do not understand why.

iA1 09-19-2018 11:47 AM

Quote:

Originally Posted by carik (Post 2596420)
in the delivery report in onesignal if you look there writes here such
Filters {"key":"uid","field":"tag","value":"10234362","rel ation":"="}
all links in notifications have the wrong view. How to fix it? Thank you!

Check your forum url settings in Admincp -> Settings -> Options -> Site Name / URL / Contact Details
https://www.carhelp.info/forums/admi...ogroup=address

Have you entered the correct url for your forum there?

Quote:

Originally Posted by carik (Post 2596422)
in the settings of the service configured not to open in a new tab, but to switch to the tab if it is open in the browser. still open a new tab. I do not understand why.

This is something which cannot be controlled from this add-on. It can only be configured from OneSignal.

iA1 09-19-2018 11:49 AM

Quote:

Originally Posted by carik (Post 2596413)
https://www.carhelp.info/showthread....aign=onesignal Here such link comes in push, I think the end superfluous?

The end part is for Google Analytics. If you use analytics, then you can easily check how many users clicked on the notification and visited your forum.

carik 09-19-2018 12:06 PM

Quote:

Originally Posted by iA1 (Post 2596423)
Check your forum url settings in Admincp -> Settings -> Options -> Site Name / URL / Contact Details
https://www.carhelp.info/forums/admi...ogroup=address

Have you entered the correct url for your forum there?

Yes, it's all true. links to e-mail come correct.



Quote:

Originally Posted by iA1 (Post 2596423)
This is something which cannot be controlled from this add-on. It can only be configured from OneSignal.

probably because of the incorrect links, there on the service I set everything correctly.

carik 09-19-2018 12:10 PM

Quote:

Originally Posted by iA1 (Post 2596424)
The end part is for Google Analytics. If you use analytics, then you can easily check how many users clicked on the notification and visited your forum.

I do not have such settings anywhere.
but the question is why the link to push notification comes here is this:
PHP Code:

https://www.carhelp.info/showthread.php?p=1544887&utm_source=onesignal&utm_medium=push&utm_campaign=onesignal 

but here is the email:
PHP Code:

https://www.carhelp.info/forums/showthread.php?t=147458&p=1544887#post1544887 

a link to the email opens a topic or a PM, and the link from the push notification opens first 404 and then goes to the main page of the forum.

carik 09-19-2018 12:36 PM

PHP Code:

$contentId $post['postid']; 

???
PHP Code:

$contentId $threadid['threadid']&goto=newpost


iA1 09-19-2018 05:56 PM

1 Attachment(s)
Quote:

Originally Posted by carik (Post 2596426)
I do not have such settings anywhere.
but the question is why the link to push notification comes here is this:
PHP Code:

https://www.carhelp.info/showthread.php?p=1544887&utm_source=onesignal&utm_medium=push&utm_campaign=onesignal 

but here is the email:
PHP Code:

https://www.carhelp.info/forums/showthread.php?t=147458&p=1544887#post1544887 

a link to the email opens a topic or a PM, and the link from the push notification opens first 404 and then goes to the main page of the forum.

I have modified the attached file once again for your forum. Try it and let me know if it works.

The sub-folder link for your forum is hard-coded in the links.

carik 09-19-2018 08:30 PM

Quote:

Originally Posted by iA1 (Post 2596434)
I have modified the attached file once again for your forum. Try it and let me know if it works.

The sub-folder link for your forum is hard-coded in the links.

Thank you! Now goes into the topic and to the PM!
when you go to the topic, opens the page you want, but you need to scroll the page to the post. If there are ideas how to correct I will be very grateful!

:up::up::up:

gnrx 12-16-2018 10:31 PM

Hello.
Recently, I install this fantastic mod, but I don't sure if work correct.
Appears the icon, push in the icon notification and appears: Subscribe to notifications.
Ok, but if push again, appears the same (not for disable notifications, for example). This work like indicate?

Thanks and regards!

Goomzee 12-17-2018 02:58 AM

Notification not works in 3.8x i already reply there

gnrx 12-17-2018 06:40 AM

Since I installed in vb 4.2.5 I received notifications (by forum) for new threads and pm, but onesignal not indicate, not push notification with this mod.
I don't know what happens, because, I don't have any error...

Regards.

gnrx 12-17-2018 01:16 PM

Hi, my problem was solved.
I upload the files that we download of onesignal in my forum directory (my site its: www.mydomain.com/forum) and upload the files of onesignal in /forum folder.
Error, I upload to root folder (public_html) and now, yes, work fine.

Regards.

iA1 12-17-2018 05:38 PM

Quote:

Originally Posted by carik (Post 2596444)
when you go to the topic, opens the page you want, but you need to scroll the page to the post. If there are ideas how to correct I will be very grateful!

Thanks for the feedback. I will try add it in the next update.


Quote:

Originally Posted by gnrx (Post 2597829)
Appears the icon, push in the icon notification and appears: Subscribe to notifications.
Ok, but if push again, appears the same (not for disable notifications, for example). This work like indicate?

When you click on the bell again, it shows the unsubscribe button, like this:


Quote:

Originally Posted by gnrx (Post 2597839)
Hi, my problem was solved.
I upload the files that we download of onesignal in my forum directory (my site its: www.mydomain.com/forum) and upload the files of onesignal in /forum folder.
Error, I upload to root folder (public_html) and now, yes, work fine.

Regards.

Thank you for the confirmation.

gnrx 12-17-2018 07:28 PM

Quote:

Originally Posted by iA1 (Post 2597843)
When you click on the bell again, it shows the unsubscribe button, like this:

Quote:

Thank you for the confirmation.
Yes, after upload the files of onesign to root folder (not to the folder of forum) now, appears like you indicate, if click in the bell again, now, shows the unsusbscribe button, now, work fine :)
But after this change, I have replys in suscribe threads but not have notifications in this bell.
Thanks and regards!

gnrx 12-18-2018 01:10 PM

Hello.
I continue with the tests, like indicate in last reply, yes, now when I click on the bell again, it shows the unsubscribe button like you image, appears work fine.
But when I have new reply on one thread or quoted, I don't received any notification in this bell.
I received notification in browser but I think this is because, also, I have installed Advanced User Tagging

But the bull not indicate any notification.

Thanks and regards.

iA1 12-18-2018 01:25 PM

Quote:

Originally Posted by gnrx (Post 2597850)
Hello.
I continue with the tests, like indicate in last reply, yes, now when I click on the bell again, it shows the unsubscribe button like you image, appears work fine.
But when I have new reply on one thread or quoted, I don't received any notification in this bell.
I received notification in browser but I think this is because, also, I have installed Advanced User Tagging

But the bull not indicate any notification.

Thanks and regards.

If you get notification as shown in screenshot in post #2
https://vbulletin.org/forum/showpost...89&postcount=2 then it is working fine.
The notifications are not inside the bell. It is actually browser notification. On desktop as well as on smartphone.


All times are GMT. The time now is 03:39 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01876 seconds
  • Memory Usage 1,867KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (6)bbcode_php_printable
  • (27)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete