bp_document_get_edit_activity_data( $activity )
Adds activity document data for the edit activity
Description
Parameters
- $activity
-
(Required)
Return
(array) $activity Returns the activity with document if document saved otherwise no documents.
Source
File: bp-document/bp-document-filters.php
function bp_document_get_edit_activity_data( $activity ) { if ( ! empty( $activity['id'] ) ) { // Fetch document ids of activity. $document_ids = bp_activity_get_meta( $activity['id'], 'bp_document_ids', true ); if ( ! empty( $document_ids ) ) { $activity['document'] = array(); $document_ids = explode( ',', $document_ids ); foreach( $document_ids as $document_id ) { $document = new BP_Document( $document_id ); $activity['document'][] = array( 'id' => $document_id, 'doc_id' => $document->attachment_id, 'name' => $document->title, 'group_id' => $document->group_id, 'folder_id' => $document->folder_id, 'activity_id' => $document->activity_id, 'type' => 'document', 'url' => wp_get_attachment_url( $document->attachment_id ), 'size' => filesize( get_attached_file( ( $document->attachment_id ) ) ), 'saved' => true, 'menu_order' => $document->menu_order, ); } } } return $activity; }
Changelog
Version | Description |
---|---|
BuddyBoss 1.5.1 | 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.