bp_media_user_messages_delete_attached_gif( int $thread_id, array $message_ids, int $user_id, array $update_message_ids )

Delete gif attached to messages.

Description

Parameters

$thread_id

(int) (Required) ID of the thread being deleted.

$message_ids

(array) (Required) IDs of messages being deleted.

$user_id

(int) (Required) ID of the user the threads messages update for.

$update_message_ids

(array) (Required) IDs of messages being updated.

Source

File: bp-media/bp-media-filters.php

function bp_media_user_messages_delete_attached_gif( $thread_id, $message_ids, $user_id, $update_message_ids ) {

	if ( ! empty( $update_message_ids ) ) {
		foreach ( $update_message_ids as $message_id ) {
			$message_gif = bp_messages_get_meta( $message_id, '_gif_data', true );

			if ( ! empty( $message_gif ) ) {
				if ( ! empty( $message_gif['still'] ) ) {
					wp_delete_attachment( (int) $message_gif['still'], true );
				}

				if ( ! empty( $message_gif['mp4'] ) ) {
					wp_delete_attachment( (int) $message_gif['mp4'], true );
				}
			}

			bp_messages_delete_meta( $message_id, '_gif_data' );
			bp_messages_delete_meta( $message_id, '_gif_raw_data' );
		}
	}
}

Changelog

Changelog
Version Description
BuddyBoss 1.4.9 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.