Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How do I create a notification?


3sixty
Participant

@3sixty

Just to start building this out as a how-to:

To add a notification, you would call this function located in bp-core-notifications.php

bp-core-notifications; function bp_core_add_notification( $item_id, $user_id, $component_name, $component_action, $secondary_item_id = false, $date_notified = false )

So as a test, if you wanted to store a notification that the user had just visited the activity page, you could make up a new notification type ‘activity_viewed’ and use this code:

bp_core_add_notification('100', (int)$bp->loggedin_user->id, 'activity', 'activity_viewed');

Of course, that’s useless unless we ping the user. Next step: how do we add the little notification to the buddy bar? Any ideas?

Skip to toolbar