bp_document_delete_activity_document( $activities )
Delete document when related activity is deleted.
Description
Parameters
- $activities
-
(Required)
Source
File: bp-document/bp-document-filters.php
function bp_document_delete_activity_document( $activities ) { if ( ! empty( $activities ) ) { remove_action( 'bp_activity_after_delete', 'bp_document_delete_activity_document' ); foreach ( $activities as $activity ) { $activity_id = $activity->id; $document_activity = bp_activity_get_meta( $activity_id, 'bp_document_activity', true ); if ( ! empty( $document_activity ) && '1' == $document_activity ) { bp_document_delete( array( 'activity_id' => $activity_id ) ); } // get document ids attached to 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 ) { bp_document_delete( array( 'id' => $document_id ) ); } } } add_action( 'bp_activity_after_delete', 'bp_document_delete_activity_document' ); } }
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.