/**
  * Template function to render the template
  *
  * @since 1.0
  */
 function woocommerce_points_rewards_my_points()
 {
     global $wc_points_rewards;
     $points_balance = WC_Points_Rewards_Manager::get_users_points(get_current_user_id());
     $points_label = $wc_points_rewards->get_points_label($points_balance);
     $count = apply_filters('wc_points_rewards_my_account_points_events', 5, get_current_user_id());
     // get a set of points events, ordered newest to oldest
     $args = array('orderby' => array('field' => 'date', 'order' => 'DESC'), 'per_page' => $count, 'paged' => 0, 'user' => get_current_user_id());
     $events = WC_Points_Rewards_Points_Log::get_points_log_entries($args);
     // load the template
     woocommerce_get_template('myaccount/my-points.php', array('points_balance' => $points_balance, 'points_label' => $points_label, 'events' => $events), '', $wc_points_rewards->get_plugin_path() . '/templates/');
 }
 /**
  * Prepare the list of points history items for display
  *
  * @see WP_List_Table::prepare_items()
  * @since 1.0
  */
 public function prepare_items()
 {
     global $wc_points_rewards, $wpdb;
     $per_page = $this->get_items_per_page('wc_points_rewards_points_log_events_per_page');
     // main query args
     $args = array('orderby' => array('field' => $this->get_current_orderby(), 'order' => $this->get_current_order()), 'per_page' => $per_page, 'paged' => $this->get_pagenum(), 'calc_found_rows' => true);
     // Filter: points event log by customer, event type or event date
     $args = $this->add_filter_args($args);
     // items as array
     $this->items = WC_Points_Rewards_Points_Log::get_points_log_entries($args);
     // total number of items for pagination purposes
     $found_items = WC_Points_Rewards_Points_Log::$found_rows;
     $this->set_pagination_args(array('total_items' => $found_items, 'per_page' => $per_page, 'total_pages' => ceil($found_items / $per_page)));
 }