Making custom messages notification counter

You are here:
< All Topics

Sometimes you need to create custom counter at your website.

This is example of jQuery code snippet to make counter display messages count dynamically:

<script type="text/javascript">
jQuery(document).on('bp-better-messages-update-unread', function( event, unread ) {
   var messages_count = jQuery('.header-notifications.user-messages span');
   if( unread > 0 ){
       messages_count.text(unread).attr('class', 'count');
   } else {
       messages_count.text(unread).attr('class', 'no-alert');
Previous How to replace email notifications with custom layout?
Next Open Mini Chats programmatically (WebSocket Version)
Table of Contents