Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Buddypress comment on post notification WordPress

Buddypress sends a notification when a user gets a new message on their wall. Clicking that notification takes the user to the activity.

Buddypress also sends a notification when a user leaves a comment/reply on the original wall message. Clicking that notification links to a page that can't be found.

I need to change the notification so that if the user is being notified of a reply on a wall post, it links to the parent wall post instead of directly to the activity ID.

Notifications are provided by the bp-wall plugin (https://wordpress.org/plugins/buddypress-wall/)

This is the notification code:


if ( bp_is_active( 'notifications' ) ) {
bp_notifications_add_notification( array(
'user_id' => $displayed_user->id,
'item_id' => $activity->id,
'secondary_item_id' => $loggedin_user->id,
'component_name' => $bp->activity->id,
'component_action' => 'new_at_wall',
'date_notified' => bp_core_current_time(),
'is_new' => 1,
) );
}


Answers (2)

2015-03-10

Romel Apuya answers:

if ( bp_is_active( 'notifications' ) ) {

$act_item = bp_activity_get_specific( array(
'display_comments' => true,
'activity_ids' => $activity->id
) );

bp_notifications_add_notification( array(
'user_id' => $displayed_user->id,
'item_id' => $act_item,
'secondary_item_id' => $loggedin_user->id,
'component_name' => $bp->activity->id,
'component_action' => 'new_at_wall',
'date_notified' => bp_core_current_time(),
'is_new' => 1,
) );
}


Dan Davies comments:

This returns an activity ID of 0 and so the link doesn't load the correct activity.


Romel Apuya comments:

Hi,

Seems this is solve??
You can just request a refund for this too..

2015-03-10

Arnav Joy answers:

Hi Dan,

can you show me your site ?