vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=295879

(3) Instant Notifications in Page Title like Facebook
by findingpeace
07 Mar 2013 19:17

Using javascript and AJAX, we have implemented a system that updates notifications for likes, subscribed threads, and PM's in the page title, similar to Facebook. We use it on our site:

http://psychopathfree.com/forum.php

It updates live, so even if they're visiting another site and the tab is sitting idle, they will see new notifications popup instantly.

It's not very good coding, and I'm sure there is a better way to do it :) But if anyone would like this on their site, let me know. I would be happy to share our method.

In the past day alone of enabling it, we've seen a 400+% increase in user engagement, new posts, new activity, and online users.

vimarc 07 Mar 2013 19:45

Hi I checked your site but didn't find.

findingpeace 07 Mar 2013 19:48

Hey marc, the notifications will only show up for registered users who have a notification - I can post an example screenshot here:

https://www.vbulletin.org/forum/external/2013/03/48.png

vimarc 09 Mar 2013 10:26

hi thanks..

which donate mod you are using?

FTG LIQUID CL 10 Mar 2013 00:02

I would like to have this!

findingpeace 10 Mar 2013 22:48

Quote:

Originally Posted by FTG LIQUID CL (Post 2409079)
I would like to have this!

Hi FTG - which mods do you currently use that utilize the notifications system? (ie. Recent Thanks, Subscribed Thread Notifications, etc?)

Thanks :)

FTG LIQUID CL 12 Mar 2013 21:04

VSA advanced new post

Cel Social Groups Notifications

deltahawk5 13 Mar 2013 05:59

Woah, I'd love to have this.

I have DBTech Advanced Tagging and Thanks for Post (Hippy Fix) with Notifications.

findingpeace 13 Mar 2013 22:08

Hi all,

Okay so here is the code I use, but it'll be different of course depending on what notifications mods you use. I would also definitely recommend getting the DBTech AJAX vbNotifications mod, since it will align perfectly with the instant title updates. It automatically detects & integrates both of the mods you guys have mentioned. Otherwise, users will be getting the (#) notification but still need to refresh the page to see it in the old vBulletin notifications bar.

I have chosen to put it in FORUMHOME, FORUMDISPLAY, SHOWTHREAD, and USERCP_SHELL. You could do it in any template you want these to be visible. Just keep in mind, it operates on a 30 second Javascript timer, so it will partially boost your page requests. I definitely wouldn't put it in a global template (like footer or something). It needs to be placed somewhere in the head tag.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This does two things: 1) Sets a 30 second timer (you can change this to whatever you want) to refresh the notifications. 2) Sets a single-time, 1-second timeout to refresh the notifications upon page load, in case they've updated since the click.

In each of these pages, you will also need to set the new initial Page Title. This will be different for each template you modify. For example, the Title element of USERCP_SHELL should be modified to look like this:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The bold part is the added change. You can add that as a prefix to any of the page titles and it will show the notifications in the title.

Now the part that will be different for everyone: $title_note_count

This is the variable I'm pushing to my templates through a plugin / hook. It's the current total notification count. Depending on what mods you're using, your code will probably be different than mine. Here's an example of the plugin I use:

Hook: process_templates_complete
Execution Order: 5


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I use this code because the vbNotifications mod disables the "Total Notifications" variable. If you don't use that mod, you can probably much more easily grab the total notifications by just registering the existing variable in the same hook as above, without all the database calls:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Let me know how this works, and I will stick around here to help out as much as I can :) Also, if anyone knows a better way to push notifications with AJAX, feel free to post! The timer isn't the best idea in the world, but my server's resources are 100% fine running 30 seconds. I even experimented with 5 seconds and found no performance issues.

FTG LIQUID CL 14 Mar 2013 21:32

I cant seem to get this to work.I dont use vbNotifications,where does the last piece of code go?

findingpeace 14 Mar 2013 21:48

The last part would go in a new plugin (ignore the a, b, c, d plugin) like this:

Hook: process_templates_complete
Execution Order: 5


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


FTG LIQUID CL 15 Mar 2013 17:52

OK I will give this a try.

--------------- Added 15 Mar 2013 at 17:55 ---------------

Do I leave out the entire first plugin or just the a,b,c,d, part?

findingpeace 15 Mar 2013 19:28

Yeah just leave out the first plugin entirely - that's if you need to recalculate everything, which you shouldn't if you don't have the vbNotifications mod :)

FTG LIQUID CL 15 Mar 2013 21:25

Ok great ,Im gonna go test this out!

dizzynation 15 Mar 2013 23:54

Ok, can you clarify if you are not using th DB tech mod then what code do we use exactly?


All times are GMT. The time now is 19:52.

Powered by vBulletin® Version 3.8.13
Copyright © 2019, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.