Making WordPress.org

Changeset 8270


Ignore:
Timestamp:
02/18/2019 11:49:51 PM (7 years ago)
Author:
iandunn
Message:

WordCamp Organizer Reminders: Only sync postmeta for WordCamp posts.

Previously this assumed that the current post being saved was a wordcamp post, and until recently that was always true. Something changed that allowed this to run in other contexts, like when saving an Organizer Reminder post during the process of manually sending a reminder. When that happened, the meta values for the WordCamp post would be wiped out, since there wouldn't be any matching values in $_POST from the Organizer Reminder post.

This is probably related to r8220, but it's not immediately obvious, and isn't worth sinking more time into.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php

    r8220 r8270  
    162162
    163163                // Make sure postmeta is synced with $_POST when this is called in the middle of updating a post
    164                 if ( did_action( 'transition_post_status' ) || did_action( 'save_post' ) ) {
     164                $saving_post     = ( did_action( 'transition_post_status' ) || did_action( 'save_post' ) ) && isset( $_POST['post_type'] );
     165                $saving_wordcamp = $saving_post && defined( 'WCPT_POST_TYPE_ID' ) && $_POST['post_type'] === WCPT_POST_TYPE_ID;
     166
     167                if ( $saving_wordcamp ) {
    165168                        $wordcamp_admin->metabox_save( $wordcamp->ID, $wordcamp, false );
    166169                }
     
    536539                $ready = false;
    537540
     541                // Don't retroactively send new emails to old camps, since they're already closed.
    538542                if ( strtotime( $wordcamp->post_date ) < strtotime( $email->post_date ) ) {
    539543                        return $ready;
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-reminder.php

    r8236 r8270  
    436436                }
    437437
    438                 wp_die( 'Manually sending reminders is currently disabled while I track down a nasty bug. -Ian' );
    439 
    440438                $wordcamp = get_post( $form_values['wcor_manually_send_wordcamp'] );
    441439                $WCOR_Mailer->send_manual_email( $email, $wordcamp );
Note: See TracChangeset for help on using the changeset viewer.