post_author !== $user_id && $user_id > 0 ) { return false; } // Verify the user has permission to edit this post. if ( $user_id > 0 && ! \user_can( $user_id, 'edit_post', $post->ID ) ) { return new \WP_Error( 'activitypub_forbidden', \__( 'You do not have permission to edit this post.', 'activitypub' ), array( 'status' => 403 ) ); } $post = Posts::update( $post, $activity, $visibility ); if ( \is_wp_error( $post ) ) { return $post; } /** * Fires after a post has been updated from an outgoing Update activity. * * @param int $post_id The updated post ID. * @param array $activity The activity data. * @param int $user_id The user ID. */ \do_action( 'activitypub_outbox_updated_post', $post->ID, $activity, $user_id ); return $post; } }