Please upgrade here. These earlier versions are no longer being updated and have security issues.

Favicon notification count

Im looking for a plugin that shows the notification count in the favicon. I think this is a really good feature to have for a forum.

Currently im running a view webshops that show the amount of products in the cart and i also installed a gmail 'addon' that shows the unread count, so i know it possible.

Any ideas someone?

Comments

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    A simple js way would be to include a library like http://lab.ejci.net/favico.js/ and use a script like that:

    $(function() {  
       var notificationCount = $('ul#Menu li.UserNotifications > a > span').text();
       var favicon=new Favico({
          animation:'pop'
       });
       favicon.badge(notificationCount);
    });
    

    But it would be much nicer to include that (great idea by the way) as a php plugin


    hgtonightmvaneijgenperegrine
  • Hey! thanks for the tip i forgot about favico.js but it works now. Only problem is the notification on the website don't check live only when you refresh. Is there a option

  • hgtonighthgtonight ∞ · New Moderator

    You can get the current count of notifications for a user with the following PHP code:

    $Session = Gdn::Session();
    $NotificationCount = $Session->User->CountNotifications;
    

    Get that code executed however often you want and update your favicon. I would suggest making it a plugin. Hooking into the inform notifications method would be a good idea.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

    peregrine
Sign In or Register to comment.