I've added a custom slide-out box to show a user's Buddypress notifications on any page.
https://i.stack.imgur.com/HbB7f.jpg
I'm essentially echoing the template part from the Buddypress plugin Youzify (formerly known as Youzer). Youzify is just an extension to redesign Buddypress so I believe this problem is not necessarily related to that but rather native Buddypress.
I am able to get the Notifications for the current user when I'm on any standard Wordpress page. However, if I'm on a user's profile, it shows THEIR Notifications instead! I know that by default, Admins can actually see all Notifications if they simply add /notifications to any profile slug, but this is happening for standard Users too.
This is the current code:
<?php global $bp;
if( bp_has_notifications($bp->loggedin_user->id) ) : ?>
<?php bp_get_template_part( 'members/single/notifications/notifications-loop' ); ?>
<div class="read-all-notifs"><a href="<?php bp_notifications_unread_permalink($bp->loggedin_user->id); ?>"> View All Notifications</a></div>
<?php else : ?>
<?php bp_get_template_part( 'members/single/notifications/feedback-no-notifications' ); ?>
<?php endif; ?>
I assume it's something to do with the template part and some function that forces the bp_displayed_user ID when on a Buddypress page, so how can I override that to make sure the Notifications in my popup are always for the current user on ANY page? Anyone have any ideas? Thanks.