Making WordPress.org

Changeset 859


Ignore:
Timestamp:
09/12/2014 12:07:32 AM (9 years ago)
Author:
iandunn
Message:

WordCamp Organizer Reminders: Sync postmeta before replacing placeholders.

If the fields for a wordcamp post are updated at the same time that the post_status is changed to publish
then the values stored in postmeta are potentially out of sync with the new values being submitted in $_POST.

Another approach to solving this problem would have been to pull the data from either $_POST or
postmeta based on the current state, which would be more elegant than saving postmeta an additional time, but
that would also have required duplicating some of the metabox_save() logic, like converting date strings to
timestamps, which would violate the DRY principle.

File:
1 edited

Legend:

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

    r858 r859  
    148148     */
    149149    protected function replace_placeholders( $wordcamp, $email, $content ) {
     150        /** @var $wordcamp_admin WordCamp_Admin */
     151        global $wordcamp_admin;
     152
     153        // Make sure postmeta is synced with $_POST when this is called in the middle of updating a post
     154        if ( did_action( 'transition_post_status' ) || did_action( 'save_post' ) ) {
     155            $wordcamp_admin->metabox_save( $wordcamp->ID );
     156        }
     157
    150158        $wordcamp_meta = get_post_custom( $wordcamp->ID );
    151159
Note: See TracChangeset for help on using the changeset viewer.