bp_document_update_activity_document_meta( $content, $user_id, $activity_id )
Update document for activity.
Description
Parameters
- $content
-
(Required)
- $user_id
-
(Required)
- $activity_id
-
(Required)
Return
(bool)
Source
File: bp-document/bp-document-filters.php
function bp_document_update_activity_document_meta( $content, $user_id, $activity_id ) { if ( ! isset( $_POST['document'] ) || empty( $_POST['document'] ) ) { return false; } $_POST['documents'] = $_POST['document']; $_POST['bp_activity_update'] = true; $_POST['bp_activity_id'] = $activity_id; // Update activity comment attached document privacy with parent one. if ( bp_is_active( 'activity' ) && ! empty( $activity_id ) && isset( $_POST['action'] ) && $_POST['action'] === 'new_activity_comment' ) { $parent_activity = new BP_Activity_Activity( $activity_id ); if ( $parent_activity->component === 'groups' ) { $_POST['privacy'] = 'grouponly'; } elseif ( ! empty( $parent_activity->privacy ) ) { $_POST['privacy'] = $parent_activity->privacy; } } remove_action( 'bp_activity_posted_update', 'bp_document_update_activity_document_meta', 10, 3 ); remove_action( 'bp_groups_posted_update', 'bp_document_groups_activity_update_document_meta', 10, 4 ); remove_action( 'bp_activity_comment_posted', 'bp_document_activity_comments_update_document_meta', 10, 3 ); remove_action( 'bp_activity_comment_posted_notification_skipped', 'bp_document_activity_comments_update_document_meta', 10, 3 ); $document_ids = bp_document_add_handler(); add_action( 'bp_activity_posted_update', 'bp_document_update_activity_document_meta', 10, 3 ); add_action( 'bp_groups_posted_update', 'bp_document_groups_activity_update_document_meta', 10, 4 ); add_action( 'bp_activity_comment_posted', 'bp_document_activity_comments_update_document_meta', 10, 3 ); add_action( 'bp_activity_comment_posted_notification_skipped', 'bp_document_activity_comments_update_document_meta', 10, 3 ); // save document meta for activity. if ( ! empty( $activity_id ) ) { bp_activity_update_meta( $activity_id, 'bp_document_ids', implode( ',', $document_ids ) ); } }
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.