Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 07 Mar 2013, 19:17
findingpeace's Avatar
findingpeace findingpeace is offline
 
Join Date: Nov 2011
(3) Instant Notifications in Page Title like Facebook

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.
Reply With Quote
  #2  
Old 07 Mar 2013, 19:45
vimarc's Avatar
vimarc vimarc is offline
 
Join Date: Feb 2013
Hi I checked your site but didn't find.
Reply With Quote
  #3  
Old 07 Mar 2013, 19:48
findingpeace's Avatar
findingpeace findingpeace is offline
 
Join Date: Nov 2011
Hey marc, the notifications will only show up for registered users who have a notification - I can post an example screenshot here:

Reply With Quote
  #4  
Old 09 Mar 2013, 10:26
vimarc's Avatar
vimarc vimarc is offline
 
Join Date: Feb 2013
hi thanks..

which donate mod you are using?
Reply With Quote
  #5  
Old 10 Mar 2013, 00:02
FTG LIQUID CL's Avatar
FTG LIQUID CL FTG LIQUID CL is offline
 
Join Date: Jan 2012
I would like to have this!
Reply With Quote
  #6  
Old 10 Mar 2013, 22:48
findingpeace's Avatar
findingpeace findingpeace is offline
 
Join Date: Nov 2011
Originally Posted by FTG LIQUID CL View Post
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
Reply With Quote
  #7  
Old 12 Mar 2013, 21:04
FTG LIQUID CL's Avatar
FTG LIQUID CL FTG LIQUID CL is offline
 
Join Date: Jan 2012
VSA advanced new post

Cel Social Groups Notifications
Reply With Quote
  #8  
Old 13 Mar 2013, 05:59
deltahawk5 deltahawk5 is offline
 
Join Date: Sep 2012
Woah, I'd love to have this.

I have DBTech Advanced Tagging and Thanks for Post (Hippy Fix) with Notifications.
Reply With Quote
  #9  
Old 13 Mar 2013, 22:08
findingpeace's Avatar
findingpeace findingpeace is offline
 
Join Date: Nov 2011
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.
Reply With Quote
  #10  
Old 14 Mar 2013, 21:32
FTG LIQUID CL's Avatar
FTG LIQUID CL FTG LIQUID CL is offline
 
Join Date: Jan 2012
I cant seem to get this to work.I dont use vbNotifications,where does the last piece of code go?
Reply With Quote
  #11  
Old 14 Mar 2013, 21:48
findingpeace's Avatar
findingpeace findingpeace is offline
 
Join Date: Nov 2011
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.

Reply With Quote
  #12  
Old 15 Mar 2013, 17:52
FTG LIQUID CL's Avatar
FTG LIQUID CL FTG LIQUID CL is offline
 
Join Date: Jan 2012
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?
Reply With Quote
  #13  
Old 15 Mar 2013, 19:28
findingpeace's Avatar
findingpeace findingpeace is offline
 
Join Date: Nov 2011
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
Reply With Quote
  #14  
Old 15 Mar 2013, 21:25
FTG LIQUID CL's Avatar
FTG LIQUID CL FTG LIQUID CL is offline
 
Join Date: Jan 2012
Ok great ,Im gonna go test this out!
Reply With Quote
  #15  
Old 15 Mar 2013, 23:54
dizzynation's Avatar
dizzynation dizzynation is offline
 
Join Date: Jun 2011
Ok, can you clarify if you are not using th DB tech mod then what code do we use exactly?
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 21:55.

Layout Options | Width: Wide Color: