bp_media_activity_update_media_privacy( BP_Activity_Activity $activity )

Update media privacy when activity is updated.

Description

Parameters

$activity

(Required) Activity object.

Source

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

function bp_media_activity_update_media_privacy( $activity ) {
	$media_ids = bp_activity_get_meta( $activity->id, 'bp_media_ids', true );

	if ( ! empty( $media_ids ) ) {
		$media_ids = explode( ',', $media_ids );

		foreach ( $media_ids as $media_id ) {
			$media = new BP_Media( $media_id );
			// Do not update the privacy if the media is added to forum.
			if ( ! in_array( $media->privacy, array( 'forums', 'message', 'media', 'document', 'grouponly') ) ) {
				$media->privacy = $activity->privacy;
				$media->save();
			}

		}
	}
}

Changelog

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