BuddyPress Create Notification

Trying to get my head around BuddyPress notifications.

If I wanted to send a notification to myself (user ID) 5 during a running function how would I go about doing it?


  • Adam Czajczyk
    • Support Gorilla

    Hello Kasey,

    I hope you’re having a nice day!

    On the page that you linked to there’s an example of how to send a notification and it’s taken from BP activity module. I assume that you’d like to send a notification but instead of hooking it to the “bp_activity_sent_mention_email” you would like to call it from “inside” of some of your custom function. Do I understand that correctly?

    Let’s assume that you got this function (in “pseudo-code”:wink::

    function my_function() {

    echo "Hello!";

    // send_BP_notification_here;

    echo "Notification sent!";

    Now in place where the “send_BP_notification_here” is you would like to trigger your own BP notification. To do this, you will want to introduce a custom action hook there and execute all associated functions. Example:

    function my_function() {

    echo "Hello!";


    echo "Notification sent!";

    Then you would only need to add a code similar to the one from example on BP docs page and just hook it to “send_my_function_notifications” hook:

    function bp_my_function_notifications() {

    if (bp_is_active('notifications')) {
    // here you set your notification parameters

    Now when your function (“my_function()” function) is executed it first prints “Hello!” then executes all functions assigned to the “send_my_function_notifications” hook – so it executes the “bp_my_function_notifications” function and then prints “Notification sent!”.

    I hope that makes sense :slight_smile: Would that help or did I missed anything? Let me know please if you need any more/other assistance with this.

    Best regards,


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.