bp_activity_delete_children( int $activity_id, int $comment_id )
Delete an activity comment’s children.
Description
Parameters
- $activity_id
-
(Required) The ID of the "root" activity, ie the comment's oldest ancestor.
- $comment_id
-
(Required) The ID of the comment to be deleted.
Source
File: bp-activity/bp-activity-functions.php
3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 | function bp_activity_delete_children( $activity_id , $comment_id ) { // Check if comment still exists. $comment = new BP_Activity_Activity( $comment_id ); if ( empty ( $comment ->id ) ) { return ; } // Get activity children to delete. $children = BP_Activity_Activity::get_child_comments( $comment_id ); // Recursively delete all children of this comment. if ( ! empty ( $children ) ) { foreach ( ( array ) $children as $child ) { bp_activity_delete_children( $activity_id , $child ->id ); } } // Delete the comment itself. bp_activity_delete( array ( 'secondary_item_id' => $comment_id , 'type' => 'activity_comment' , 'item_id' => $activity_id ) ); } |
Changelog
Version | Description |
---|---|
BuddyPress 1.2.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.