Tagged: Notifications
It seems that by default, you have to refresh to see any new notifications in Buddypress. Is there a way to make it so that the new notification is fetched live without having to manually refresh? I’ve seen this being done on a premium theme once, looked like it used heartbeat, redux or something of the sort? Any help would be appreciated!
Hi Alayna,
Thank You for posting, Yes you can achieve this functionality using one our free plugin named “BuddyPress Live Notification”. It works exactly like your requirement. Please refer the following Link
https://buddydev.com/plugins/buddypress-live-notification/
Thank You
RaviHello again Ravi and thanks for your response.
I have installed the plugin and it works great for the default admin bar notifications however I coded notifications into my custom header and it isn’t showing the live updates there.
Here is the code for the notifications that I have in functions.php in my child theme: http://pastebin.com/ciQL8C5C
And I call that code from header.php using <?php my_bp_adminbar_notifications_menu()?>
Hi Alayna,
Ravi will be away for a few more hours, so I am posting here.Since you have different elements, you will need to bind to ‘bpln:new_notifications’ event in javascript and handle it as you wish.
Please see the code below to find what data you can access
https://github.com/sbrajesh/bp-live-notification/blob/master/assets/js/bpln.js#L128Hope that helps.
Regards
BrajeshHi Alayna,
Please refer the following url as I have bind a callback function to this event here
Thank You
RaviHi Alayna,
You can do something like this.
jQuery(document).on( 'bpln:new_notifications', function( event, res ){ // pass count selector here jQuery('#count').text(res.count); //to show no. of count // pass message selector here jQuery('#message').html(res.messages); //alert(res.count); });
Thank You
RaviThank you, I gave that a try and successfully tied the event to the count, but whenever a new notification came in, the count would just go down to 1 and stay there instead of increasing.
I can’t seem to get this working successfully so I think I’m going to give up here. Might hire a developer for it.
Thank you for your help regardless!
You must be logged in to reply to this topic.