bp_document_update_activity_privacy( int $activity_id, string $privacy = '' )
Update activity document privacy based on activity.
Description
Parameters
- $activity_id
-
(Required) Activity ID.
- $privacy
-
(Optional) Privacy
Default value: ''
Source
File: bp-document/bp-document-functions.php
function bp_document_update_activity_privacy( $activity_id = 0, $privacy = '' ) { global $wpdb, $bp; if ( empty( $activity_id ) || empty( $privacy ) ) { return; } // Update privacy for the documents which are uploaded in root of the documents. $document_ids = bp_activity_get_meta( $activity_id, 'bp_document_ids', true ); if ( ! empty( $document_ids ) ) { $document_ids = explode( ',', $document_ids ); if ( ! empty( $document_ids ) ) { foreach ( $document_ids as $id ) { $document = new BP_Document( $id ); if ( empty( $document->folder_id ) ) { $q = $wpdb->prepare( "UPDATE {$bp->document->table_name} SET privacy = %s WHERE id = %d", $privacy, $id ); $wpdb->query( $q ); } } } } }
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.