bp_document_activity_update_document_privacy( $activity )

Update document privacy when activity is updated.

Description

Parameters

$activity

(Required) Activity object.

Source

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

function bp_document_activity_update_document_privacy( $activity ) {
	$document_ids = bp_activity_get_meta( $activity->id, 'bp_document_ids', true );

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

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

Changelog

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.