Esempio n. 1
0
 /**
  * 
  * @global type $wp_crm_user
  * @param type $wp_crm_user
  */
 static function wp_crm_user_loaded($wp_crm_user)
 {
     global $wp_crm_user;
     $user_email = $wp_crm_user['user_email']['default'][0];
     $user_id = $wp_crm_user['ID']['default'][0];
     $wpi_query['recipient'] = $user_id;
     if ($user_invoices = WPI_Functions::query($wpi_query)) {
         $wp_crm_user['has_invoices'] = true;
         $wp_crm_user['user_invoices'] = $user_invoices;
     }
     add_action('wp_crm_metaboxes', array('WPI_WPC', 'wp_crm_metaboxes'));
 }
 /**
  * Get search results based on query.
  *
  * @todo Needs to be updated to handle the AJAX requests.
  *
  */
 function prepare_items($wpi_search = false) {
   
   if(!isset($this->all_items)) {
     $this->all_items = WPI_Functions::query( $wpi_search );
   }
   
   //** Do pagination  */
   if(!empty($this->all_items) && $this->_args['per_page'] != -1) {
     $this->item_pages = array_chunk($this->all_items, $this->_args['per_page']);
     
     $total_chunks = count($this->item_pages);
     
     //** figure out what page chunk we are on based on iDisplayStart
     $this_chunk = ($this->_args['iDisplayStart'] / $this->_args['per_page']);
     
     //** Get page items */
     $this->items = $this->item_pages[$this_chunk];
     
   } else {
     $this->items = $this->all_items;
   }
 }