} static function count_comment_by_email($email, $post_id = false, $comment_type = false) { if (!$email) { return 0; } if ($email) { global $wpdb; $query = 'SELECT COUNT(comment_ID) FROM ' . $wpdb->comments . ' WHERE comment_author_email = "' . $email . '"'; if ($post_id) { $query .= ' AND comment_post_ID="' . sanitize_title_for_query($post_id) . '"'; } if ($comment_type) { $query .= ' AND comment_type="' . sanitize_title_for_query($comment_type) . '"'; } $count = $wpdb->get_var($query); return $count; } } static function count_review($user_id = false, $post_id = false) { return self::count_comment($user_id, $post_id, "st_reviews"); } static function count_review_by_email($email, $post_id = false) { return self::count_comment_by_email($email, $post_id, "st_reviews"); } } $User = new STUser(); $User->init(); }
</a> <p class="booking-item-review-person-name"> <?php printf(__('%s', ST_TEXTDOMAIN), sprintf('<cite class="fn">%s</cite>', get_comment_author_link())); ?> </p> <p class="booking-item-review-person-loc"><?php $user_show_address = apply_filters('st_user_show_address', false); if ($user_show_address) { echo get_user_meta($user_id, 'st_address', true); } ?> </p> <small> <a href="#"><?php $review = STUser::count_review_by_email($user_email); ?> <?php if ($review == 0) { st_the_language('0_review'); } elseif ($review == 1) { st_the_language('1_review'); } else { printf(__('%d ', ST_TEXTDOMAIN) . st_get_language('reviews'), $review); } ?> </a> </small> </div> </div>