Changeset 6966 for sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks/addons/allergy.php
- Timestamp:
- 03/29/2018 01:19:10 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks/addons/allergy.php
r6945 r6966 5 5 6 6 use CampTix_Plugin, CampTix_Addon; 7 use WP_Post; 8 use PHPMailer; 7 9 8 10 /** … … 25 27 add_filter( 'camptix_form_register_complete_attendee_object', array( $this, 'populate_attendee_object' ), 10, 2 ); 26 28 add_action( 'camptix_checkout_update_post_meta', array( $this, 'save_registration_field' ), 10, 2 ); 29 add_action( 'camptix_ticket_emailed', array( $this, 'after_email_receipt' ) ); 27 30 28 31 // Edit info field … … 84 87 * Add the value of the new field to the attendee object during checkout processing. 85 88 * 86 * @param \WP_Post $attendee89 * @param WP_Post $attendee 87 90 * @param array $data 88 91 * 89 * @return \WP_Post92 * @return WP_Post 90 93 */ 91 94 public function populate_attendee_object( $attendee, $data ) { … … 99 102 * 100 103 * @param int $post_id 101 * @param \WP_Post $attendee104 * @param WP_Post $attendee 102 105 * 103 106 * @return bool|int 104 107 */ 105 108 public function save_registration_field( $post_id, $attendee ) { 106 $this->maybe_send_notification_email( $attendee->{ self::SLUG }, get_post( $post_id ) );107 108 109 return update_post_meta( $post_id, 'tix_' . self::SLUG, $attendee->{ self::SLUG } ); 109 110 } 110 111 111 112 /** 113 * Initialize email notifications after the ticket receipt email has been sent. 114 * 115 * @param WP_Post $attendee_id 116 */ 117 public function after_email_receipt( $attendee_id ) { 118 $attendee = get_post( $attendee_id ); 119 $value = get_post_meta( $attendee_id, 'tix_' . self::SLUG, true ); 120 121 if ( $attendee instanceof WP_Post && 'tix_attendee' === $attendee->post_type ) { 122 $this->maybe_send_notification_email( $value, $attendee ); 123 } 124 } 125 126 /** 112 127 * Retrieve the stored value of the new field for use on the Edit Info form. 113 128 * 114 129 * @param array $ticket_info 115 * @param \WP_Post $attendee130 * @param WP_Post $attendee 116 131 * 117 132 * @return array … … 127 142 * 128 143 * @param array $data 129 * @param \WP_Post $attendee144 * @param WP_Post $attendee 130 145 * 131 146 * @return bool|int … … 171 186 * 172 187 * @param string $value 173 * @param \WP_Post $attendee188 * @param WP_Post $attendee 174 189 */ 175 190 protected function maybe_send_notification_email( $value, $attendee ) { … … 184 199 if ( $already_sent ) { 185 200 return; 201 } 202 203 global $phpmailer; 204 if ( $phpmailer instanceof PHPMailer ) { 205 // Clear out any lingering content from a previously sent message. 206 $phpmailer = new PHPMailer( true ); 186 207 } 187 208
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)