bp_media_messages_delete_attached_media( $thread_id,  $message_ids )

Delete media attached to messages

Description

Parameters

$thread_id

(Required)

$message_ids

(Required)

Source

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

function bp_media_messages_delete_attached_media( $thread_id, $message_ids ) {

    if ( ! empty( $message_ids ) ) {
        foreach( $message_ids as $message_id ) {

            // get media ids attached to message
	        $media_ids = bp_messages_get_meta( $message_id, 'bp_media_ids', true );

	        if ( ! empty( $media_ids ) ) {
		        $media_ids = explode( ',', $media_ids );
                foreach( $media_ids as $media_id ) {
                    bp_media_delete( $media_id );
                }
            }
        }
    }
}

Changelog

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