/** * @param $atts * * @return string */ public static function cbratingsystem_top_rated_user($atts) { global $post; if (!is_object($post)) { return ''; } //Example: [cbratingsystem rating_form_id=1] $options = shortcode_atts(array('post_id' => '', 'form_id' => '', 'user_id' => '', 'post_time' => '0', 'limit' => 10, 'posttype' => '0', 'post_filter' => '', 'order' => 'DESC', 'title' => __('Top Rated Users', 'cbratingsystem')), $atts); //var_dump($options); $limit = $options['limit']; if ($options['post_time'] != 0) { $date = CBRatingSystemFunctions::get_calculated_date($options['post_time']); $options['post_date'] = $date; } $data = CBRatingSystemData::get_top_rated_post($options, false, $limit); $cbrp_output = '<ul class="cbrp-top-rated-wpanel" style="">'; if (!empty($data)) { foreach ($data as $newdata) { $cbrp_output .= '<li class="cbrp-top-rated-userlist">'; $author_info = get_userdata((int) $newdata['post_author']); $cbrp_output .= '<div style=""> <a style="" href="' . get_author_posts_url((int) $newdata['post_author']) . ' ">' . $author_info->display_name . ' </a></div> <div style=""> ' . $newdata['post_count'] . ' Posts</div>'; $rating = $newdata['rating'] / 100 * 5; ?> <script> jQuery(document).ready(function ($) { $('#cbrp-top-rated<?php echo $newdata['post_author'] . '_' . $post->ID; ?> ').raty({ half : true, path : '<?php echo CB_RATINGSYSTEM_PLUGIN_DIR_IMG; ?> ', score : <?php echo number_format($rating, 2, '.', ''); ?> , readOnly: true, hintList: ['', '', '', '', ''] }); }); </script> <?php $cbrp_output .= ' <strong>' . number_format($rating, 2, '.', '') . '/5</strong> '; $cbrp_output .= '<div id ="cbrp-top-rated' . $newdata['post_author'] . '_' . $post->ID . '" style=""></div> </li>'; } } else { $cbrp_output .= ' <li class="cbrp-top-rated-userlist">' . __('No Results found', 'cbratingsystem') . ' </li>'; } $cbrp_output .= '</ul>'; return $cbrp_output; }