user_id ) { return; } $type = false; if ( 'approved' === $new_status && 'approved' !== $old_status ) { $type = 'Create'; } elseif ( 'approved' === $new_status ) { $type = 'Update'; \update_comment_meta( $comment->comment_ID, 'activitypub_comment_modified', time(), true ); } elseif ( 'trash' === $new_status || 'spam' === $new_status ) { $type = 'Delete'; } if ( empty( $type ) ) { return; } // Check if comment should be federated or not. if ( ! should_comment_be_federated( $comment ) ) { return; } add_to_outbox( $comment, $type, $comment->user_id ); } /** * Schedule Comment Activities on insert. * * @param int $comment_id Comment ID. * @param \WP_Comment $comment Comment object. */ public static function schedule_comment_activity_on_insert( $comment_id, $comment ) { if ( 1 === (int) $comment->comment_approved ) { self::schedule_comment_activity( 'approved', '', $comment ); } } }