Advertisement
johncarlson21

Untitled

Oct 10th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. function users(){
  2.  
  3.         global $wpdb;  
  4.  
  5.         extract($_POST);
  6.  
  7.         // data
  8.         $data = array();
  9.  
  10.         // coupon
  11.         $data['coupon'] = $wpdb->get_row($wpdb->prepare("SELECT * FROM `".TBL_MGM_COUPON."` WHERE id=%d", $id ));
  12.  
  13.         // users
  14.         // $data['users'] = array();
  15.         // $data['users'] = mgm_get_all_userids(array('ID'), 'get_results');
  16.         $meta_query = array(                        array('key'=>'_mgm_user_register_coupon','value'=>$id,'compare'=>'=','type'=>'UNSIGNED'),
  17.             array('key'=>'_mgm_user_upgrade_coupon','value'=>$id,'compare'=>'=','type'=>'UNSIGNED'),                    array('key'=>'_mgm_user_extend_coupon','value'=>$id,'compare'=>'=','type'=>'UNSIGNED')
  18.                             );
  19.  
  20. //error_log("starting pull");
  21.          // fixes
  22.         $usrs = array();
  23.         $us = array();
  24.         foreach($meta_query as $key) {
  25.             $usrs = array_merge($usrs, mgm_get_users_with_meta( array($key), null, null, 'OR'));
  26.             //$mg = mgm_get_users_with_meta( array($key), null, null, null);
  27.             //$us = array_merge($us, $mg);
  28.         }
  29.        
  30. //error_log(print_r($us,true));
  31.         $data['users'] = $usrs;
  32.         //$data['users'] = mgm_get_users_with_meta( $meta_query, null, null, 'OR' );
  33.        
  34. //error_log(print_r($data,true));
  35. //error_log("finish pull");
  36.  
  37.         // load template view
  38.         $this->load->template('coupons/users', array('data'=>$data));
  39.  
  40.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement