comment_post_ID ) ) { return; } if ( ! in_array( $comment->comment_type, [ 'review', 'comment', '' ], true ) || (int) $comment->comment_parent > 0 ) { return; } // WP_Comment keeps its id as a numeric string. $id = (int) $comment->comment_ID; $rating = (int) get_comment_meta( $id, 'rating', true ); $via = get_comment_meta( $id, '_rahkar_review_via', true ); $order = (int) get_comment_meta( $id, '_rahkar_review_order', true ); Outbox::add( 'review.submitted', [ 'review_id' => (string) $comment->comment_ID, 'product_id' => (string) $comment->comment_post_ID, 'rating' => $rating >= 1 && $rating <= 5 ? $rating : null, 'user_id' => Contract::id( (int) $comment->user_id ), 'order_id' => Contract::id( $order ), 'via' => 'invite' === $via ? 'invite' : 'organic', 'status' => 1 === (int) $approved ? 'approved' : 'pending', ] ); } }