bp_document_sync_document_data( $attachment_id )
Sync the description of the document with the media attachment.
Description
Parameters
- $attachment_id
-
(Required)
Source
File: bp-document/bp-document-filters.php
function bp_document_sync_document_data( $attachment_id ) {
if ( ! is_admin() || wp_doing_ajax() ) {
return;
}
global $wpdb, $bp;
// Check if document is attached to a document.
$document = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->document->table_name} WHERE attachment_id = %d", $attachment_id ) ); // db call ok; no-cache ok;
if ( $document ) {
$document_post = get_post( $attachment_id );
$document = bp_document_rename_file( $document->id, $attachment_id, $document_post->post_title, 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.