bp_media_update_activity_privacy( int $activity_id, string $privacy = '' )
Update activity media privacy based on activity.
Description
Parameters
- $activity_id
-
(Required) Activity ID.
- $privacy
-
(Optional) Privacy
Default value: ''
Source
File: bp-media/bp-media-functions.php
function bp_media_update_activity_privacy( $activity_id = 0, $privacy = '' ) { global $wpdb, $bp; if ( empty( $activity_id ) || empty( $privacy ) ) { return; } // Update privacy for the media which are uploaded in activity. $media_ids = bp_activity_get_meta( $activity_id, 'bp_media_ids', true ); if ( ! empty( $media_ids ) ) { $media_ids = explode( ',', $media_ids ); if ( ! empty( $media_ids ) ) { foreach ( $media_ids as $id ) { $media = new BP_Media( $id ); if ( ! empty( $media->id ) ) { $media->privacy = $privacy; $media->save(); } } } } }
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.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.