bp_media_update_activity_media_meta( $content, $user_id, $activity_id )
Update media for activity
Description
Parameters
- $content
-
(Required)
- $user_id
-
(Required)
- $activity_id
-
(Required)
Return
(bool)
Source
File: bp-media/bp-media-filters.php
function bp_media_update_activity_media_meta( $content, $user_id, $activity_id ) { if ( ! isset( $_POST['media'] ) || empty( $_POST['media'] ) ) { return false; } $_POST['medias'] = $_POST['media']; $_POST['bp_activity_update'] = true; $_POST['bp_activity_id'] = $activity_id; // Update activity comment attached document privacy with parent one. if ( ! 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_media_update_activity_media_meta', 10, 3 ); remove_action( 'bp_groups_posted_update', 'bp_media_groups_activity_update_media_meta', 10, 4 ); remove_action( 'bp_activity_comment_posted', 'bp_media_activity_comments_update_media_meta', 10, 3 ); remove_action( 'bp_activity_comment_posted_notification_skipped', 'bp_media_activity_comments_update_media_meta', 10, 3 ); $media_ids = bp_media_add_handler(); add_action( 'bp_activity_posted_update', 'bp_media_update_activity_media_meta', 10, 3 ); add_action( 'bp_groups_posted_update', 'bp_media_groups_activity_update_media_meta', 10, 4 ); add_action( 'bp_activity_comment_posted', 'bp_media_activity_comments_update_media_meta', 10, 3 ); add_action( 'bp_activity_comment_posted_notification_skipped', 'bp_media_activity_comments_update_media_meta', 10, 3 ); // save media meta for activity. if ( ! empty( $activity_id ) ) { bp_activity_update_meta( $activity_id, 'bp_media_ids', implode( ',', $media_ids ) ); } }
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.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.