Warning: 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 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.


Top ↑

Parameters Parameters

$activity_ids

(array) (Optional) Activity IDs whose comments should be deleted.

Default value: array()

$delete_meta

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

Default value: true


Top ↑

Return Return

(bool) True on success.


Source 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})" );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 This method has been deprecated.
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.