bp_media_update_media_privacy( $album )
Update media privacy according to album’s privacy
Description
Parameters
- $album
-
(Required)
Source
File: bp-media/bp-media-filters.php
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | function bp_media_update_media_privacy( & $album ) { if ( ! empty ( $album ->id ) ) { $privacy = $album ->privacy; $media_ids = BP_Media::get_album_media_ids( $album ->id ); $activity_ids = array (); if ( ! empty ( $media_ids ) ) { foreach ( $media_ids as $media ) { $media_obj = new BP_Media( $media ); $media_obj ->privacy = $privacy ; $media_obj ->save(); $attachment_id = $media_obj ->attachment_id; $main_activity_id = get_post_meta( $attachment_id , 'bp_media_parent_activity_id' , true ); if ( ! empty ( $main_activity_id ) ) { $activity_ids [] = $main_activity_id ; } } } if ( ! empty ( $activity_ids ) ) { foreach ( $activity_ids as $activity_id ) { $activity = new BP_Activity_Activity( $activity_id ); if ( ! empty ( $activity ) ) { $activity ->privacy = $privacy ; $activity ->save(); } } } } } |
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.