Changeset 674 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php
- Timestamp:
- 06/04/2014 09:50:47 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php
r664 r674 43 43 // Post status transitions 44 44 add_action( 'transition_post_status', array( $this, 'add_organizer_to_central' ), 10, 3 ); 45 add_action( 'transition_post_status', array( $this, 'notify_mes_sponsors_when_wordcamp_scheduled' ), 10, 3 );46 45 add_action( 'wp_insert_post_data', array( $this, 'require_complete_meta_to_publish_wordcamp' ), 10, 2 ); 47 46 … … 444 443 445 444 /** 446 * Notify Multi Event Sponsors when a new WordCamp in their region is added to the schedule.447 *448 * This assumes that all of the meta fields we use are filled in, but that should be a safe assumption449 * since we require them to be before publishing the post. This will need to be updated if that ever450 * changes, though.451 *452 * @param string $new_status453 * @param string $old_status454 * @param WP_Post $wordcamp455 */456 public function notify_mes_sponsors_when_wordcamp_scheduled( $new_status, $old_status, $wordcamp ) {457 if ( empty( $wordcamp->post_type ) || WCPT_POST_TYPE_ID != $wordcamp->post_type ) {458 return;459 }460 461 if ( 'pending' != $old_status || 'publish' != $new_status || ! class_exists( 'MES_Sponsor' )) {462 return;463 }464 465 $wordcamp_region = (int) get_post_meta( $wordcamp->ID, 'Multi-Event Sponsor Region', true );466 467 if ( ! $wordcamp_region ) {468 return;469 }470 471 $wordcamp_sponsor_wrangler_email = get_post_meta( $wordcamp->ID, 'Sponsor Wrangler E-mail Address', true );472 $wordcamp_lead_organizer_email = get_post_meta( $wordcamp->ID, 'Email Address', true );473 474 $mes_sponsors = get_posts( array(475 'post_type' => MES_Sponsor::POST_TYPE_SLUG,476 'numberposts' => -1,477 ) );478 479 foreach ( $mes_sponsors as $sponsor ) {480 $sponsor_email_address = get_post_meta( $sponsor->ID, 'mes_email_address', true );481 $sponsor_first_name = get_post_meta( $sponsor->ID, 'mes_first_name', true );482 $sponsor_regional_sponsorships = get_post_meta( $sponsor->ID, 'mes_regional_sponsorships', true );483 484 if ( ! $sponsor_email_address || ! is_numeric( $sponsor_regional_sponsorships[ $wordcamp_region ] ) ) {485 continue;486 }487 488 $headers = array(489 'Reply-To: support@wordcamp.org',490 'CC: ' . $wordcamp_sponsor_wrangler_email . ', ' . $wordcamp_lead_organizer_email,491 );492 493 $message_body = sprintf(494 "Howdy, %s! This email is to tell you that %s has been added to the schedule and has accepted your sponsorship offer.495 496 Their site is: %s497 498 Their date is: %s, and they expect about %d attendees.499 500 Their venue address is:501 502 %s503 504 Their shipping address is:505 506 %s507 508 Their Twitter handle is %s and their hashtag is %s509 510 You can reach them by emailing: %s or %s511 512 Your company information and logo will be displayed on the WordCamp's site shortly.513 514 Thanks for your support of %s!515 516 Best wishes,517 518 Andrea519 520 Andrea Middleton521 WordCamp Central",522 sanitize_text_field( $sponsor_first_name ),523 sanitize_text_field( $wordcamp->post_title ),524 esc_url( get_site_url( absint( get_post_meta( $wordcamp->ID, '_site_id', true ) ) ) ),525 date( 'l, F jS, Y', absint( get_post_meta( $wordcamp->ID, 'Start Date (YYYY-mm-dd)', true ) ) ),526 absint( get_post_meta( $wordcamp->ID, 'Number of Anticipated Attendees', true ) ),527 strip_tags( get_post_meta( $wordcamp->ID, 'Physical Address', true ) ),528 strip_tags( get_post_meta( $wordcamp->ID, 'Mailing Address', true ) ),529 esc_url( 'https://twitter.com/' . get_post_meta( $wordcamp->ID, 'Twitter', true ) ),530 esc_url( 'https://twitter.com/hashtag/' . get_post_meta( $wordcamp->ID, 'WordCamp Hashtag', true ) ),531 sanitize_text_field( get_post_meta( $wordcamp->ID, 'E-mail Address', true ) ),532 sanitize_text_field( get_post_meta( $wordcamp->ID, 'Sponsor Wrangler E-mail Address', true ) ),533 sanitize_text_field( $wordcamp->post_title )534 );535 536 wp_mail(537 $sponsor_email_address,538 $wordcamp->post_title . ' has accepted your sponsorship offer',539 str_replace( "\t", '', $message_body ),540 $headers541 );542 }543 }544 545 /**546 445 * Prevent WordCamp posts from being published until all the required fields are completed. 547 446 *
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)