Changeset 8374
- Timestamp:
- 02/28/2019 03:34:07 PM (7 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt
- Files:
-
- 4 edited
-
wcpt-event/class-event-admin.php (modified) (8 diffs)
-
wcpt-event/class-event-application.php (modified) (2 diffs)
-
wcpt-meetup/class-meetup-admin.php (modified) (4 diffs)
-
wcpt-wordcamp/wordcamp-admin.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-event/class-event-admin.php
r8262 r8374 259 259 * @return string 260 260 */ 261 public function set_locale_to_en_ US() {261 public function set_locale_to_en_us() { 262 262 return 'en_US'; 263 263 } … … 280 280 281 281 // Ensure status labels are in English. 282 add_filter( 'locale', array( $this, 'set_locale_to_en_ US' ) );282 add_filter( 'locale', array( $this, 'set_locale_to_en_us' ) ); 283 283 284 284 $old_status = get_post_status_object( $old_status ); … … 302 302 303 303 // Remove the temporary locale change. 304 remove_filter( 'locale', array( $this, 'set_locale_to_en_ US' ) );304 remove_filter( 'locale', array( $this, 'set_locale_to_en_us' ) ); 305 305 } 306 306 … … 315 315 316 316 /** 317 * Schedule notifica iton for declined application. Currently supports WordCamp and Meetup317 * Schedule notification for declined application. Currently supports WordCamp and Meetup. 318 318 * 319 319 * @param WP_Post $event Event object. … … 331 331 * @param string $label 332 332 * @param string $location 333 * 334 * @return null|bool|string 333 335 */ 334 336 public static function send_decline_notification( $event_id, $label, $location ) { 337 $declined_notification_key = 'sent_declined_notification'; 338 if ( get_post_meta( $event_id, $declined_notification_key, true ) ) { 339 return null; 340 } 341 335 342 $message = sprintf( 336 343 'A %s application for %s has been declined, and the applicant has been informed via email.', … … 340 347 341 348 $attachment = create_event_status_attachment( $message, $event_id, '' ); 342 wcpt_slack_notify( COMMUNITY_TEAM_SLACK, $attachment ); 349 350 $notification_sent = wcpt_slack_notify( COMMUNITY_TEAM_SLACK, $attachment ); 351 if ( $notification_sent ) { 352 update_post_meta( $event_id, $declined_notification_key, true ); 353 } 354 return $notification_sent; 343 355 } 344 356 … … 443 455 444 456 // Don't add/remove meta on trash, untrash, restore, etc. 457 // phpcs:ignore WordPress.Security.NonceVerification.Missing 445 458 if ( empty( $_POST['action'] ) || 'editpost' !== $_POST['action'] ) { 446 459 return; … … 453 466 } 454 467 } 455 456 468 457 469 $meta_keys = $this->meta_keys(); -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-event/class-event-application.php
r8104 r8374 64 64 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- We do not verify nonce for frontend forms because WP Super Cache may cache an expired nonce token. 65 65 if ( isset( $_POST['submit-application'] ) ) { 66 // phpcs:ignore WordPress.Security.NonceVerification.Missing 66 67 $this->submit_application( $_POST ); 67 68 } else { … … 237 238 238 239 /** 239 * Notify in community slack channel that we've received an application 240 * Notify in community slack channel that we've received an application. 240 241 */ 241 242 public function notify_new_application_in_slack() { -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-meetup/class-meetup-admin.php
r8193 r8374 511 511 * @param WP_Post $meetup Meetup post object. 512 512 * 513 * @return bool|string513 * @return null|bool|string 514 514 */ 515 515 public static function notify_new_meetup_group_in_slack( $meetup ) { 516 516 $new_group_notification_key = 'sent_new_group_notification'; 517 if ( get_post_meta( $meetup->ID, $new_group_notification_key, true ) ) { 518 return null; 519 } 517 520 // Not translating strings here because these will be sent to Slack. 518 521 $city = get_post_meta( $meetup->ID, 'Meetup Location', true ); … … 523 526 $message = sprintf( 524 527 "Let's welcome the new WordPress meetup group%s%s, to the chapter! :tada: :community: :wordpress:\n%s", 525 isset( $city ) ? " in $city," : "",526 isset( $organizer_slack ) ? " organized by @$organizer_slack" : "",528 empty( $city ) ? '' : " in $city,", 529 empty( $organizer_slack ) ? '' : " organized by @$organizer_slack", 527 530 $meetup_link 528 531 ); … … 530 533 $attachment = create_event_status_attachment( $message, $meetup->ID, $title ); 531 534 532 return wcpt_slack_notify( COMMUNITY_EVENTS_SLACK, $attachment ); 535 $notification_sent = wcpt_slack_notify( COMMUNITY_EVENTS_SLACK, $attachment ); 536 if ( $notification_sent ) { 537 update_post_meta( $meetup->ID, $new_group_notification_key, true ); 538 } 539 return $notification_sent; 533 540 } 534 541 … … 783 790 } 784 791 } 785 // Disabling the new organizer notification because its a lot of work, and not always possible to find someone's wporg username from their meetup profile 786 // self::new_meetup_organizers_notify( $new_meetup_org_data ); 787 } 788 789 /** 790 * Send email containing new meetup organizers to WordCamp Support team. Also adds a tag - `Needs to update Organizer list` 791 * 792 * @param array $new_meetup_org_data 793 */ 794 public static function new_meetup_organizers_notify( $new_meetup_org_data ) { 795 if ( empty( $new_meetup_org_data ) ) { 796 return; 797 } 798 799 $template = <<<HTML 800 Hi, 801 <br><br> 802 New organizers have been added for following meetups. Please update their wporg usernames in their meetup tracker page. 803 <br><br> 804 HTML; 805 $count = 0; 806 foreach ( $new_meetup_org_data as $post_id => $new_meetup_org ) { 807 $count ++; 808 $title = get_the_title( $post_id ); 809 $meetup_tracker_url = get_site_url() . "/wp-admin/post.php?post=$post_id&action=edit"; 810 $template = $template . "$count. <a href='$meetup_tracker_url' rel='noreferrer' target='_blank' >$title</a> : "; 811 $meetup_group_url = get_post_meta( $post_id, 'Meetup URL', true ); 812 $meetup_members = array(); 813 foreach ( $new_meetup_org as $organizer ) { 814 $organizer_id = esc_html( $organizer['id'] ); 815 $organizer_name = esc_html( $organizer['name'] ); 816 $meetup_members[] = "<a href='$meetup_group_url/members/$organizer_id' target='_blank' rel='noreferrer' >$organizer_name</a>"; 817 } 818 $template = $template . join( ', ', $meetup_members ) . '<br>'; 819 820 // Add a tag for meetup. 821 wp_set_object_terms( $post_id, 'Needs to update Organizer list', 'meetup_tags', true ); 822 } 823 wp_mail( 824 array( 'support@wordcamp.org' ), 825 'New Meetup organizer added', 826 $template, 827 array( 828 'From: noreply@wordcamp.org', 829 'Content-Type: text/html; charset=UTF-8', 830 ) 831 ); 832 } 792 } 793 833 794 } 834 795 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php
r8328 r8374 744 744 * @param WP_Post $wordcamp 745 745 * 746 * @return null|bool 746 * @return null|bool|string 747 747 */ 748 748 public static function notify_new_wordcamp_in_slack( $wordcamp ) { 749 $scheduled_notification_key = 'sent_scheduled_notification'; 750 if ( get_post_meta( $wordcamp->ID, $scheduled_notification_key, true ) ) { 751 return null; 752 } 753 749 754 // Not translating any string because they will be sent to slack. 750 755 $city = get_post_meta( $wordcamp->ID, 'Location', true ); … … 762 767 $attachment = create_event_status_attachment( $message, $wordcamp->ID, $title ); 763 768 764 return wcpt_slack_notify( COMMUNITY_EVENTS_SLACK, $attachment ); 769 $notification_sent = wcpt_slack_notify( COMMUNITY_EVENTS_SLACK, $attachment ); 770 if ( $notification_sent ) { 771 update_post_meta( $wordcamp->ID, $scheduled_notification_key, true ); 772 } 773 return $notification_sent; 765 774 } 766 775
Note: See TracChangeset
for help on using the changeset viewer.