Changeset 691
- Timestamp:
- 06/11/2014 08:10:36 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php
r674 r691 42 42 43 43 // Post status transitions 44 add_action( 'transition_post_status', array( $this, 'add_organizer_to_central' ), 10, 3 ); 44 add_action( 'transition_post_status', array( $this, 'trigger_schedule_actions' ), 10, 3 ); 45 add_action( 'wcpt_added_to_planning_schedule', array( $this, 'add_organizer_to_central' ), 10 ); 45 46 add_action( 'wp_insert_post_data', array( $this, 'require_complete_meta_to_publish_wordcamp' ), 10, 2 ); 46 47 … … 416 417 417 418 /** 418 * Add the lead organizer to Central when a WordCamp application is accepted.419 * 420 * When an application is submitted, a `wordcamp` post is created with a `draft` status. When it's accepted ,421 * t he status changes to `pending`. Adding the lead organizer to Central allows them to enter all the `wordcamp`422 * meta info themselves, and also post updates to the Central blog.419 * Trigger actions related to WordCamps being scheduled. 420 * 421 * When an application is submitted, a `wordcamp` post is created with a `draft` status. When it's accepted 422 * to the planning schedule the status changes to `pending`, and when it's accepted for the final schedule 423 * the status changes to 'publish'. 423 424 * 424 425 * @param string $new_status … … 426 427 * @param WP_Post $post 427 428 */ 428 public function add_organizer_to_central( $new_status, $old_status, $post ) {429 public function trigger_schedule_actions( $new_status, $old_status, $post ) { 429 430 if ( empty( $post->post_type ) || WCPT_POST_TYPE_ID != $post->post_type ) { 430 431 return; 431 432 } 432 433 433 if ( 'draft' != $old_status || 'pending' != $new_status ) { 434 return; 435 } 436 434 if ( 'draft' == $old_status && 'pending' == $new_status ) { 435 do_action( 'wcpt_added_to_planning_schedule', $post ); 436 } elseif ( 'pending' == $old_status && 'publish' == $new_status ) { 437 do_action( 'wcpt_added_to_final_schedule', $post ); 438 } 439 } 440 441 /** 442 * Add the lead organizer to Central when a WordCamp application is accepted. 443 * 444 * Adding the lead organizer to Central allows them to enter all the `wordcamp` 445 * meta info themselves, and also post updates to the Central blog. 446 * 447 * @param WP_Post $post 448 */ 449 public function add_organizer_to_central( $post ) { 437 450 $lead_organizer = get_user_by( 'login', get_post_meta( $post->ID, 'WordPress.org Username', true ) ); 438 451
Note: See TracChangeset
for help on using the changeset viewer.