ID; //create new object if passed a wp_user } if($username){ parent::__construct($person_id, $username); }elseif( is_numeric($person_id) && $person_id == 0 ){ $this->ID = 0; $this->display_name = 'Non-Registered User'; $this->user_email = 'n/a'; }else{ parent::__construct($person_id); } $this->phone = get_metadata('user', $this->ID, 'dbem_phone', true); //extra field for EM do_action('em_person',$this, $person_id, $username); } function get_bookings($ids_only = false){ global $wpdb; $blog_condition = ''; if( is_multisite() ){ if( !is_main_site() ){ //not the main blog, force single blog search $blog_condition = "AND e.blog_id=".get_current_blog_id(); }elseif(is_main_site() && !get_option('dbem_ms_global_events')){ $blog_condition = "AND (e.blog_id=".get_current_blog_id().' OR e.blog_id IS NULL)'; } } $EM_Booking = new EM_Booking(); //empty booking for fields $results = $wpdb->get_results("SELECT b.".implode(', b.', array_keys($EM_Booking->fields))." FROM ".EM_BOOKINGS_TABLE." b, ".EM_EVENTS_TABLE." e WHERE e.event_id=b.event_id AND person_id={$this->ID} {$blog_condition} ORDER BY event_start_date DESC",ARRAY_A); $bookings = array(); if($ids_only){ foreach($results as $booking_data){ $bookings[] = $booking_data['booking_id']; } return $bookings; }else{ foreach($results as $booking_data){ $bookings[] = new EM_Booking($booking_data); } return new EM_Bookings($bookings); } } /** * @return EM_Events */ function get_events(){ global $wpdb; $events = array(); foreach( $this->get_bookings()->get_bookings() as $EM_Booking ){ $events[$EM_Booking->event_id] = $EM_Booking->get_event(); } return $events; } function display_summary(){ ob_start(); ?>
ID); ?> |
: get_name() ?> : user_email; ?> : phone; ?> |