Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How do I create a notification?

@r-a-y

Keymaster

The best way to figure these things out is to look at how the default BP system does it~!

Look at how friendship notifications are made in bp-friends.php and bp-friends-notifications.php

1) Create a function that contains the bp_core_add_notification() and hook it into a particular BP action.

You probably did not hook your custom function to any BP action, that’s why it isn’t doing anything.

2) Format the notification.

Here, you create a new function that formats the notification. You will use the $component_action you defined in your custom function from bp_core_add_notification(). You will hook this new function into the core component’s notification function.

Look at friends_format_notifications() in bp-friends.php for more info.

3) Delete the notification.

You’ll probably want to delete the notification when someone has viewed it!

Create a function with one of the notification delete functions in bp-core-notifications.php and hook it to a BP action.

Skip to toolbar