Making WordPress.org

Changeset 2964


Ignore:
Timestamp:
04/15/2016 02:07:39 PM (10 years ago)
Author:
kovshenin
Message:

WordCamp: Run configure_new_site earlier and only once.

We no longer need to offload this to the save_post action
because all meta fields are saved during wcpt_metabox_save_done.

See: r2962.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php

    r2963 r2964  
    106106                $path = isset( $url_components['path'] ) ? $url_components['path'] : '';
    107107
     108                $wordcamp          = get_post( $wordcamp_id );
    108109                $wordcamp_meta     = get_post_custom( $wordcamp_id );
    109110                $lead_organizer    = $this->get_user_or_current_user( $wordcamp_meta['WordPress.org Username'][0]  );
     
    114115                        update_post_meta( $wordcamp_id, '_site_id', $this->new_site_id );    // this is used in other plugins to map the `wordcamp` post to it's corresponding site
    115116                        do_action( 'wcor_wordcamp_site_created', $wordcamp_id );
    116 
    117                         // Configure the new site at priority 11, after all the custom fields on the `wordcamp` post have been saved, so that we don't use outdated values
    118                         add_action( 'save_post', array( $this, 'configure_new_site' ), 11, 2 );
    119117
    120118                        add_post_meta( $wordcamp_id, '_note', array(
     
    123121                                'message'   => sprintf( 'Created site at <a href="%s">%s</a>', $url, $url ),
    124122                        ) );
     123
     124                        $this->configure_new_site( $wordcamp_id, $wordcamp );
    125125                }
    126126        }
     
    148148         * @todo Can probably just network-activate plugins instead, but need to test that they work fine in network-activated mode.
    149149         *
    150          * @action save_post
    151          *
    152150         * @param int     $wordcamp_id
    153151         * @param WP_Post $wordcamp
    154152         */
    155         public function configure_new_site( $wordcamp_id, $wordcamp ) {
     153        protected function configure_new_site( $wordcamp_id, $wordcamp ) {
    156154                if ( ! defined( 'WCPT_POST_TYPE_ID' ) || WCPT_POST_TYPE_ID != $wordcamp->post_type || ! is_numeric( $this->new_site_id ) ) {
    157155                        return;
Note: See TracChangeset for help on using the changeset viewer.