This method has been deprecated.

BP_Activity_Activity::delete_activity_item_comments( array $activity_ids = array(), bool $delete_meta = true )

Delete the comments associated with a set of activity items.

Description

This method is no longer used by BuddyPress, and it is recommended not to use it going forward, and use BP_Activity_Activity::delete() instead.

Parameters

$activity_ids

(Optional) Activity IDs whose comments should be deleted.

Default value: array()

$delete_meta

(Optional) Should we delete the activity meta items for these comments.

Default value: true

Return

(bool) True on success.

Source

File: bp-activity/classes/class-bp-activity-activity.php

	public static function delete_activity_item_comments( $activity_ids = array(), $delete_meta = true ) {
		global $wpdb;

		$bp = buddypress();

		$delete_meta  = (bool) $delete_meta;
		$activity_ids = implode( ',', wp_parse_id_list( $activity_ids ) );

		if ( $delete_meta ) {
			// Fetch the activity comment IDs for our deleted activity items.
			$activity_comment_ids = $wpdb->get_col( "SELECT id FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" );

			if ( ! empty( $activity_comment_ids ) ) {
				self::delete_activity_meta_entries( $activity_comment_ids );
			}
		}

		return $wpdb->query( "DELETE FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" );
	}

Changelog

Changelog
Version Description
2.3.0 This method has been deprecated.
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.