/** * create_new_attendee * * @param EE_Registration $registration * @param array $attendee_data * @return \EE_Attendee */ private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { // create new attendee object $new_attendee = EE_Attendee::new_instance($attendee_data); // set author to event creator $new_attendee->set('ATT_author', $registration->event()->wp_user()); $new_attendee->save(); return $new_attendee; }
function column_Event(EE_Registration $item) { $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => $event->ID()), REG_ADMIN_URL); $event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="' . $chkin_lnk_url . '" title="' . esc_attr__('View Checkins for this Event', 'event_espresso') . '">' . $event->name() . '</a>' : $event->name(); return $event_label; }
/** * toggle_registration_status_for_default_approved_events * * @access public * @param EE_Registration $registration * @param bool $save TRUE will save the registration if the status is updated, FALSE will leave that up to client code * @return boolean */ public function toggle_registration_status_for_default_approved_events(EE_Registration $registration, $save = TRUE) { // set initial REG_Status $this->set_old_reg_status($registration->ID(), $registration->status_ID()); // if not already, toggle reg status to approved IF the event default reg status is approved if ($registration->status_ID() !== EEM_Registration::status_id_approved && $registration->event()->default_registration_status() == EEM_Registration::status_id_approved) { // set incoming REG_Status $this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved); // toggle status to approved $registration->set_status(EEM_Registration::status_id_approved); if ($save) { $registration->save(); } // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor if (!EE_Processor_Base::$IPN) { // otherwise, send out notifications add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); } // DEBUG LOG //$this->log( // __CLASS__, __FUNCTION__, __LINE__, // $registration->transaction(), // array( // 'IPN' => EE_Processor_Base::$IPN, // 'deliver_notifications' => has_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' ), // ) //); return TRUE; } return FALSE; }
/** * Set the $_transaction_details property if not set yet. * * @param EE_Registration $registration */ protected function _set_related_details(EE_Registration $registration) { $transaction = $registration->get_first_related('Transaction'); $status = $transaction instanceof EE_Transaction ? $transaction->status_ID() : EEM_Transaction::failed_status_code; $this->_transaction_details = array('transaction' => $transaction, 'status' => $status, 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, 'title_attr' => sprintf(__('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))); $event = $registration->event(); $status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive; $this->_event_details = array('event' => $event, 'status' => $status, 'id' => $event instanceof EE_Event ? $event->ID() : 0, 'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))); }
/** * toggle_registration_status_if_no_monies_owing * determine whether to toggle free tickets to "Approved" based on payment status (kinda sorta) of other tickets for * the same event. So if more than one ticket for the same event is in the cart, and one or more tickets are NOT * free, then free tickets will NOT be automatically toggled to "Approved" * * @access public * @param bool $toggle_registration_status * @param \EE_Registration $registration * @return bool */ public static function toggle_registration_status_if_no_monies_owing($toggle_registration_status = false, EE_Registration $registration) { $reg_tickets = array(); if ($registration instanceof EE_Registration && $registration->transaction() instanceof EE_Transaction) { // now we need to get an accurate count of registration tickets foreach ($registration->transaction()->registrations() as $reg) { if ($reg instanceof EE_Registration) { if ($reg->event() instanceof EE_Event && $reg->ticket() instanceof EE_Ticket) { $reg_tickets[$reg->event()->ID()][$reg->ticket()->ID()] = $reg->ticket()->is_free(); } } } } if ($registration->ticket() instanceof EE_Ticket && $registration->ticket()->is_free()) { $toggle_registration_status = true; if ($registration->event() instanceof EE_Event && isset($reg_tickets[$registration->event()->ID()])) { foreach ($reg_tickets[$registration->event()->ID()] as $free_ticket) { $toggle_registration_status = $free_ticket ? $toggle_registration_status : false; } } } return $toggle_registration_status; }