Can someone help me with this?
This is supposed to go into functions.php:
function cg_current_user_notification_count() {
$notifications = bp_core_get_notifications_for_user(bp_loggedin_user_id(), 'object');
$count = !empty($notifications) ? count($notifications) : 0;
echo $count;
}
In the templates where you want to show it.
<?php cg_current_user_notification_count(); ?>
Source: https://premium.wpmudev.org/forums/topic/add-buddypress-notifications-to-theme
The error I am getting is as follows, though:
fatal error: Uncaught Error: Call to undefined function
bp_core_get_notifications_for_user() in
/Applications/MAMP/htdocs/wp-content/themes/mytheme-child/functions.php:18
Stack trace: #0
Can someone help me with this? The function is not deprecated, so that can’t be the issue…
What might be the problem here?
Read more here: Can’t get buddypress notifications in front-end; why do I get this error?