bp_document_update_document_privacy( $folder )
Update document privacy according to folder’s privacy.
Description
Parameters
- $folder
-
(Required)
Source
File: bp-document/bp-document-filters.php
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | function bp_document_update_document_privacy( & $folder ) { if ( ! empty ( $folder ->id ) ) { $privacy = $folder ->privacy; $document_ids = BP_Document::get_folder_document_ids( $folder ->id ); $activity_ids = array (); if ( ! empty ( $document_ids ) ) { foreach ( $document_ids as $document ) { $document_obj = new BP_Document( $document ); $document_obj ->privacy = $privacy ; $document_obj ->save(); $attachment_id = $document_obj ->attachment_id; $main_activity_id = get_post_meta( $attachment_id , 'bp_document_parent_activity_id' , true ); if ( ! empty ( $main_activity_id ) ) { $activity_ids [] = $main_activity_id ; } } } if ( bp_is_active( 'activity' ) && ! 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.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.