コード例 #1
0
 /**
  * Updates shop rating
  *
  * @access public
  * @param int $ID
  * @return void
  */
 public static function updateRating($ID)
 {
     $rating = get_comment_meta($ID, 'rating', true);
     if (!empty($rating)) {
         $comment = get_comment($ID);
         $user = get_post_field('post_author', $comment->comment_post_ID);
         $shop = ThemexUser::getShop($user);
         $rating = ThemexWoo::getRating($user);
         ThemexCore::updatePostMeta($shop, 'rating', $rating['rating']);
         ThemexCore::updatePostMeta($shop, 'ratings', $rating['ratings']);
     }
 }