Changeset 8083 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-event/class-event-application.php
- Timestamp:
- 01/15/2019 09:06:15 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-event/class-event-application.php
r7619 r8083 7 7 8 8 namespace WordPress_Community\Applications; 9 require_once WCPT_DIR . 'wcpt-event/notification.php'; 9 10 10 11 /** … … 85 86 public function submit_application() { 86 87 $application_data = $this->validate_data( $_POST ); 88 87 89 if ( $this->is_rate_limited() ) { 88 90 $message = __( 'You have submitted too many applications recently. Please wait and try again in a few hours.', 'wordcamporg' ); … … 93 95 } else { 94 96 $this->create_post( $application_data ); 95 $this->notify_applicant_application_received( $this->get_organizer_email(), $this->get_event_location() ); 97 $this->notify_applicant_application_received( 98 $this->get_organizer_email(), 99 $this->get_event_location() 100 ); 101 102 $this->notify_new_application_in_slack(); 103 96 104 $message = __( "Thank you for your application! We've received it, and we'll contact you once we've had a chance to review it.", 'wordcamporg' ); 97 105 $notice_classes = 'notice-success'; … … 175 183 176 184 /** 185 * Get default status for a new application. 186 * 187 * @return string|null 188 */ 189 abstract public static function get_default_status(); 190 191 /** 192 * Get publicly accessible report url for a event. Should return null if such report is published. 193 * 194 * @return string|null 195 */ 196 abstract public static function get_application_report_url(); 197 198 /** 177 199 * Display a notice to applicant while submitting the form. 178 200 * … … 192 214 * 193 215 * @param string $email_address 194 * @param string $ meetup_city195 */ 196 public function notify_applicant_application_received( $email_address, $ meetup_city ) {216 * @param string $event_city 217 */ 218 public function notify_applicant_application_received( $email_address, $event_city ) { 197 219 //translators: Name of the event. Egs WordCamp. 198 220 $subject = sprintf( __( "We've received your %s application", 'wpct' ), $this->get_event_label() ); … … 204 226 'wpct' 205 227 ), 206 $this->get_event_label(), sanitize_text_field( $ meetup_city )228 $this->get_event_label(), sanitize_text_field( $event_city ) 207 229 ); 208 230 209 231 wp_mail( $email_address, $subject, $message, $headers ); 210 232 } 233 234 /** 235 * Notify in community slack channel that we've received an application 236 */ 237 public function notify_new_application_in_slack() { 238 239 // Not translating because this will be sent to community events slack channel. 240 $message = sprintf( "A %s application for %s has been received.", $this->get_event_label(), $this->get_event_location() ); 241 242 $public_report_url = $this->get_application_report_url(); 243 if ( isset( $public_report_url ) ) { 244 // `<%s|here> is syntax for slack message to hyperlink text `here` with url provided in `%s` 245 $message = sprintf( "%s Public status can be followed on <%s|%s application report page>.", $message, $public_report_url, $this->get_event_label() ); 246 } 247 248 $default_status = $this->get_default_status(); 249 $queue_size = wp_count_posts( $post_type=$this->get_event_type() )->$default_status; 250 if ( isset( $queue_size ) ) { 251 $singular = "is $queue_size application"; 252 $plural = "are $queue_size applications"; 253 $message = sprintf( 254 "%s\n _There %s in vetting queue._", 255 $message, 256 1 === $queue_size ? $singular : $plural ); 257 } 258 259 $attachment = create_event_attachment( $message, sprintf( "New %s application ", $this->get_event_label() ) ); 260 return wcpt_slack_notify( COMMUNITY_TEAM_SLACK, $attachment ); 261 } 211 262 }
Note: See TracChangeset
for help on using the changeset viewer.