You can achieve this without raw SQL by looping through the replies and filtering out the author’s own ones. Something like this:
$reply_count = 0;
$replies = bbp_get_all_child_ids( $topic_id, bbp_get_reply_post_type() );
if ( ! empty( $replies ) ) {
foreach ( $replies as $reply_id ) {
if ( get_post_field( ‘post_author’, $reply_id ) != $author_id ) {
$reply_count++;
}
}
}
This way you count only replies not made by the topic author. Then you can compare $reply_count with your threshold to trigger the reward.
It’s lightweight, avoids direct SQL, and keeps everything inside bbPress/WordPress functions.