Changeset 8083 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-event/class-event-admin.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-admin.php
r8080 r8083 56 56 add_action( 'transition_post_status', array( $this, 'log_status_changes' ), 10, 3 ); 57 57 58 add_action( 'transition_post_status', array( $this, 'notify_application_status_in_slack' ), 10, 3 ); 59 58 60 add_filter( 'redirect_post_location', array( $this, 'add_admin_notices_to_redirect_url' ), 10, 2 ); 59 61 60 62 // Admin notices 61 63 add_action( 'admin_notices', array( $this, 'print_admin_notices' ) ); 64 65 add_action( 'send_decline_notification_action', 'Event_Admin::send_decline_notification', 10, 3 ); 66 62 67 } 63 68 … … 275 280 add_post_meta( $post->ID, "_status_change_log_$post->post_type $log_id", time() ); 276 281 } 282 } 283 284 /** 285 * Hooked to `transition_post_status`, will send notifications to community slack channels based whenever an application status changes to something that we are interested in. Most likely would be when an application is declined or accepted. 286 * 287 * @param string $new_status New status 288 * @param string $old_status Old Status 289 * @param WP_Post $event 290 */ 291 abstract public function notify_application_status_in_slack( $new_status, $old_status, WP_Post $event ); 292 293 /** 294 * Schedule notificaiton for declined application. Currently supports WordCamp and Meetup 295 * 296 * @param WP_Post $event Event object 297 * @param string $label Could be WordCamp or Meetup 298 * @param string $location 299 * 300 * @return bool|string 301 */ 302 public static function schedule_decline_notification( $event, $label, $location ) { 303 wp_schedule_single_event( time() + DAY_IN_SECONDS, 'send_decline_notification_action', array( $event->ID, $label, $location ) ); 304 } 305 306 /** 307 * Send declined notification to community team slack channel. 308 * 309 * @param int $event_id 310 * @param string $label 311 * @param string $location 312 */ 313 public static function send_decline_notification( $event_id, $label, $location ) { 314 $message = sprintf( 315 "A %s application for %s has been declined, and the applicant has been informed via email.", 316 $label, 317 $location 318 ); 319 320 $attachment = create_event_status_attachment( $message, $event_id, '' ); 321 wcpt_slack_notify( COMMUNITY_TEAM_SLACK, $attachment ); 277 322 } 278 323
Note: See TracChangeset
for help on using the changeset viewer.