Remove custom notifications after click
-
Hello,
I’m trying to connect BuddyPress to an outside AI system. The system must be able to send custom notifications to the users. I’ve coded a simple component that formats the custom notifications. However, once a notification has been created, it doesn’t disappear. How can I remove a single notification after it’s clicked?
I have used the BuddyPress skeleton component, and the code appears to be:
function agents_remove_screen_notifications() {
global $bp;/**
* When clicking on a screen notification, we need to remove it from the menu.
* The following command will do so.
*/
bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->agents->id, 'alert' );
}
add_action( 'bp_example_screen_one', 'agents_remove_screen_notifications' );
I don’t understand where the action is triggered, and it seems that all the notifications of the same type are removed, not only the one the user has clicked.
How can I solve the problem?
Thank you.
- The topic ‘Remove custom notifications after click’ is closed to new replies.