Making WordPress.org


Ignore:
Timestamp:
08/13/2018 11:52:14 AM (6 years ago)
Author:
vedjain
Message:

WordCamp: Support Meetup Applications and review in central.

Major refactor to WordCamp post types, to extract out code which is then used in Meetup post types and application. This code is not 5.x compatible.
Eventually, the aim is to credit contributors for their work organizing meetup groups in the WordPress chapter program, and make use of existing administrative tools to meetup applications/groups.

This is the (Non exhaustive) test plan after this commit is deployed:

  • Existing WordCamp schedule
  • WordCamp organizer application render.
  • Submit WordCamp application. Fill all fields and make sure they exists in app.
  • Verify original application.
  • Verify protected fields.
  • Verify REST API responses for wordcamp posts (#)
  • Status mapping, and transition to valid next statuses.
  • Move application from Needs Vetting to Needs Site. Add private notes.
  • Track and verify application status page.
  • Create a site for wordcamp

Test plan for Meetups

  • Submit meetup applications. Fill all fields and make sure they are saved.
  • Change application status. Add and remove meta box fields to make sure they are saved.
File:
1 edited

Legend:

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

    r6186 r7607  
    66define( 'WCPT_DEFAULT_STATUS', 'wcpt-needs-vetting' );
    77define( 'WCPT_FINAL_STATUS',   'wcpt-closed'        );
     8
     9require_once WCPT_DIR . 'wcpt-event/class-event-loader.php';
    810
    911if ( ! class_exists( 'WordCamp_Loader' ) ) :
     
    1618 *
    1719 */
    18 class WordCamp_Loader {
     20class WordCamp_Loader extends Event_Loader {
    1921
    2022    /**
     
    2224     */
    2325    function __construct() {
    24         add_action( 'plugins_loaded',                  array( $this, 'includes'                          ) );
    25         add_action( 'init',                            array( $this, 'register_post_types'               ) );
    26         add_action( 'init',                            array( $this, 'register_post_capabilities'        ) );
    27         add_action( 'init',                            array( $this, 'register_post_statuses'            ) );
    28         add_filter( 'pre_get_posts',                   array( $this, 'query_public_statuses_on_archives' ) );
     26        parent::__construct();
    2927        add_action( 'wp_insert_post_data',             array( $this, 'set_scheduled_date'                ) );
    3028        add_filter( 'wordcamp_rewrite_rules',          array( $this, 'wordcamp_rewrite_rules'            ) );
     
    132130    }
    133131
    134     public function register_post_statuses() {
    135         foreach ( self::get_post_statuses() as $key => $label ) {
    136             register_post_status( $key, array(
    137                 'label' => $label,
    138                 'public' => true,
    139                 'label_count' => _nx_noop(
    140                     sprintf( '%s <span class="count">(%s)</span>', $label, '%s' ),
    141                     sprintf( '%s <span class="count">(%s)</span>', $label, '%s' ),
    142                     'wordcamporg'
    143                 ),
    144             ) );
    145         }
    146     }
    147 
    148     /**
    149      * Only query the public post statuses on WordCamp archives and feeds
    150      *
    151      * By default, any public post statuses are queried when the `post_status` parameter is not explicitly passed
    152      * to WP_Query. This causes central.wordcamp.org/wordcamps/ and central.wordcamp.org/wordcamps/feed/ to display
    153      * camps that are `needs-vetting`, etc, which is not desired.
    154      *
    155      * Another way to fix this would have been to register some of the posts statuses as `private`, but they're not
    156      * consistently used in a public or private way, so that would have had more side effects.
    157      *
    158      * @param WP_Query $query
    159      */
    160     public function query_public_statuses_on_archives( $query ) {
    161         if ( ! $query->is_post_type_archive( WCPT_POST_TYPE_ID ) ) {
    162             return;
    163         }
    164 
    165         if ( is_admin() ) {
    166             return;
    167         }
    168 
    169         // Sort by the date it was added to the schedule. See WordCamp_Loader::set_scheduled_date() for details.
    170         if ( '' === $query->get( 'orderby' ) ) {
    171             $query->set( 'orderby', 'menu_order date' );
    172         }
    173 
    174         if ( ! empty( $query->query_vars['post_status'] ) ) {
    175             return;
    176         }
    177 
    178         $query->query_vars['post_status'] = self::get_public_post_statuses();
    179     }
     132
    180133
    181134    /**
Note: See TracChangeset for help on using the changeset viewer.