Did you try this hook do_action( 'bbp_trash_topic', $topic_id );
found in bbp_trash_topic
?
@shanebp Thank you for the kindly reply
Yes i am using it.
i think you mean i have to call this action in theme funcation ourside the bp localfile.
unction bbp_trash_topic( $topic_id = 0 ) {
// Validate topic ID
$topic_id = bbp_get_topic_id( $topic_id );
if ( empty( $topic_id ) || !bbp_is_topic( $topic_id ) )
return false;
$args = array(
'user_id' => 386,
'item_id' => $topic_id,
'secondary_item_id' => 0,
'component_name' => 'forums',
'component_action' => 'new_topic',
);
bp_notifications_delete_notifications_by_item_id( $args );
do_action( 'bbp_trash_topic', $topic_id );
Please ignore the args param just added a notification param to see if will delete it
but never happend
Sorry for my bad english i hope u understand me.
Waiting for reply,
it’s so important to delete notification when deleting Topic, Reply as defualt
Regards
You should not change that function. You should use the hook.
Try something like this in your theme functions.php:
function hosam_delete_notification( $topic_id ) {
// you cannot send an array
// create individual variables
$user_id = 386; // etc
bp_notifications_delete_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false );
}
add_action( 'bbp_trash_topic', 'hosam_delete_notification' );