Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions app/main/controllers/upload/RTMediaUploadEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,22 @@ public function template_redirect( $create_activity = true ) {
$model = new RTMediaUploadModel();
do_action( 'rtmedia_upload_set_post_object' );
$this->upload = $model->set_post_object();
unset( $this->upload['activity_id'] );

if ( -1 !== $_activity_id && ! empty( $_activity_id ) ) {
Comment thread
Intenzi marked this conversation as resolved.
$can_attach = false;
// Query the activity to check if the activity belongs to the user.
if ( is_user_logged_in() && function_exists( 'bp_activity_get_specific' ) ) {
$activity = bp_activity_get_specific( array( 'activity_ids' => array( intval( $_activity_id ) ) ) );
if ( ! empty( $activity['activities'][0] ) && intval( $activity['activities'][0]->user_id ) === get_current_user_id() ) {
$can_attach = true;
}
}

if ( -1 !== $_activity_id ) {
$this->upload['activity_id'] = $_activity_id;
$activity_id = $_activity_id;

if ( $can_attach ) {
$this->upload['activity_id'] = $_activity_id;
$activity_id = $_activity_id;
}
}

// Media uploaded into a group takes its privacy from that group.
Expand Down
Loading