bp_document_delete( array|string $args = '', bool $from = false )
Delete document.
Description
Parameters
- $args
-
(Optional) To delete specific document items, use $args = array( 'id' => $ids ); Otherwise, to use filters for item deletion, the argument format is the same as BP_Document::get(). See that method for a description.
Default value: ''
- $from
-
(Optional) Context of deletion from. ex. attachment, activity etc.
Default value: false
Return
(bool|int) The ID of the document on success. False on error.
Source
File: bp-document/bp-document-functions.php
function bp_document_delete( $args = '', $from = false ) {
// Pass one or more the of following variables to delete by those variables.
$args = bp_parse_args(
$args,
array(
'id' => false,
'blog_id' => false,
'attachment_id' => false,
'user_id' => false,
'title' => false,
'folder_id' => false,
'activity_id' => false,
'group_id' => false,
'privacy' => false,
'date_created' => false,
)
);
/**
* Fires before an document item proceeds to be deleted.
*
* @param array $args Array of arguments to be used with the document deletion.
*
* @since BuddyBoss 1.4.0
*/
do_action( 'bp_before_document_delete', $args );
$document_ids_deleted = BP_Document::delete( $args, $from );
if ( empty( $document_ids_deleted ) ) {
return false;
}
/**
* Fires after the document item has been deleted.
*
* @param array $args Array of arguments used with the document deletion.
*
* @since BuddyBoss 1.4.0
*/
do_action( 'bp_document_delete', $args );
/**
* Fires after the document item has been deleted.
*
* @param array $document_ids_deleted Array of affected document item IDs.
*
* @since BuddyBoss 1.4.0
*/
do_action( 'bp_document_deleted_documents', $document_ids_deleted );
return true;
}
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.