Making WordPress.org


Ignore:
Timestamp:
08/17/2018 09:32:41 AM (8 years ago)
Author:
vedjain
Message:

WordCamp: Multiple changes to Meetup Application.

  1. Make styling more consistent of Meetup Application with WordCamp Application.
  2. Added more statuses and tags. Specifically, added checkboxes for statuses like Needs Swag, Needs Orientation etc, which will add a tag for easy filtering.
  3. Added tag column in Meetup listing view.
  4. Add different questions for Meetup location and for organizer's mailing address.
  5. Street address, state and zip code fields are optional.
  6. Added log box for tracking tag changes.
File:
1 edited

Legend:

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

    r7610 r7619  
    5555        return array(
    5656            'wcpt-mtp-nds-vet'   => _x( 'Needs Vetting', 'Meetup status', 'wordcamporg' ),
    57             'wcpt-mtp-more-info' => _x( 'More Info Requested', 'Meetup status', 'wordcamporg' ),
    5857            'wcpt-mtp-nds-ori'   => _x( 'Needs Orientation/Interview', 'Meetup status', 'wordcamporg' ),
     58            'wcpt-mtp-schdlng'   => _x( 'Scheduling', 'Meetup status', 'wordcamporg' ),
     59            'wcpt-mtp-schdld'    => _x( 'Scheduled', 'Meetup status', 'wordcamporg' ),
    5960            'wcpt-mtp-nds-sit'   => _x( 'Needs Site', 'Meetup status', 'wordcamporg' ),
    6061            'wcpt-mtp-nds-trn'   => _x( 'Needs Transfer', 'Meetup status', 'wordcamporg' ),
    6162            'wcpt-mtp-nds-nw-ow' => _x( 'Needs to assign new owner', 'Meetup status', 'wordcamporg' ),
    6263            'wcpt-mtp-chng-req'  => _x( 'Changes requested', 'Meetup status', 'wordcamporg' ),
    63             'wcpt-mtp-nds-swag'  => _x( 'Needs Swag', 'Meetup status', 'wordcamporg' ),
    6464            'wcpt-mtp-rejected'  => _x( 'Declined', 'Meetup status', 'wordcamporg' ),
    65             'wcpt-mtp-active'    => _x( 'Active', 'Meetup status', 'wordcamporg' ),
     65            'wcpt-mtp-active'    => _x( 'Active in the chapter', 'Meetup status', 'wordcamporg' ),
    6666            'wcpt-mtp-dormant'   => _x( 'Dormant', 'Meetup status', 'wordcamporg' ),
    67             'wcpt-mtp-removed'   => _x( 'Removed', 'Meetup status', 'wordcamporg' ),
     67            'wcpt-mtp-removed'   => _x( 'Removed from the chapter', 'Meetup status', 'wordcamporg' ),
    6868        );
    6969    }
     
    129129
    130130        $required_fields = array(
    131             'q_first_name',
    132             'q_last_name',
     131            'q_name',
    133132            'q_email',
    134133            'q_city',
    135             'q_state',
    136134            'q_country',
    137             'q_zip',
     135            'q_mtp_loc',
    138136            'q_already_a_meetup',
    139137            'q_describe_yourself',
     
    151149        foreach ( $required_fields as $field ) {
    152150            if ( empty( $safe_data[ $field ] ) ) {
     151                error_log('field is: '. $field);
    153152                return new \WP_Error( 'required_fields', "Please click on your browser's Back button, and fill in all of the required fields." );
    154153            }
     
    166165        // WordCamp uses an ID with questions. Not sure how are they used. Ask @corey
    167166        $values = array(
    168             'q_first_name'          => '',
    169             'q_last_name'           => '',
     167            'q_name'                => '',
    170168            'q_email'               => '',
     169            'q_address_line_1'      => '',
     170            'q_address_line_2'      => '',
    171171            'q_city'                => '',
    172172            'q_state'               => '',
    173173            'q_country'             => '',
    174174            'q_zip'                 => '',
     175            'q_mtp_loc'             => '',
    175176            'q_already_a_meetup'    => '',
    176177            'q_existing_meetup_url' => '',
     
    178179            'q_wporg_username'      => '',
    179180            'q_wp_slack_username'   => '',
     181            'q_additional_comments' => '',
    180182        );
    181183
     
    192194    public function create_post( $data ) {
    193195        // Create the post.
    194         $user     = wcorg_get_user_by_canonical_names( $data['q_wporg_username'] );
     196        $wordcamp_user_id = get_user_by( 'email', 'support@wordcamp.org' )->ID;
    195197        $statuses = self::get_post_statuses();
    196198
    197199        $post = array(
    198200            'post_type'   => self::get_event_type(),
    199             'post_title'  => $data['q_city'] . ', ' . $data['q_country'],
     201            'post_title'  => esc_html( $data['q_mtp_loc'] ),
    200202            'post_status' => self::get_default_status(),
    201             'post_author' => is_a( $user, 'WP_User' ) ? $user->ID : 0,
     203            'post_author' => $wordcamp_user_id,
    202204        );
    203205
     
    211213        add_post_meta( $post_id, '_application_data', $data );
    212214
    213         add_post_meta(
    214             $post_id, 'Organizer Name', sprintf(
    215                 '%s %s',
    216                 $data['q_first_name'],
    217                 $data['q_last_name']
    218             )
    219         );
    220 
     215        $organizer_address = <<<ADDRESS
     216        {$data['q_address_line_1']}
     217        {$data['q_address_line_2']}
     218        {$data['q_city']}, {$data['q_state']}, {$data['q_country']}
     219        {$data['q_zip']}
     220ADDRESS;
     221
     222        add_post_meta( $post_id, 'Organizer Name', $data['q_name'] );
    221223        add_post_meta( $post_id, 'Email', $data['q_email'] );
    222         add_post_meta( $post_id, 'City', $data['q_city'] );
    223         add_post_meta( $post_id, 'State', $data['q_state'] );
    224         add_post_meta( $post_id, 'Country', $data['q_country'] );
    225         add_post_meta( $post_id, 'Zip', $data['q_zip'] );
     224        add_post_meta( $post_id, 'City', $data['q_mtp_loc'] );
     225        add_post_meta( $post_id, 'Address', $organizer_address );
    226226        add_post_meta( $post_id, 'Already a meetup', $data['q_already_a_meetup'] );
    227227        add_post_meta( $post_id, 'Meetup URL', $data['q_existing_meetup_url'] );
    228228        add_post_meta( $post_id, 'Best describe organizer', $data['q_describe_yourself'] );
    229229        add_post_meta( $post_id, 'Primary organizer WordPress.org username', $data['q_wporg_username'] );
    230         add_post_meta( $post_id, 'Skype/Slack', $data['q_wp_slack_username'] );
     230        add_post_meta( $post_id, 'Slack', $data['q_wp_slack_username'] );
    231231        add_post_meta( $post_id, 'Date Applied', time() );
    232 
     232        add_post_meta( $post_id, 'Extra Comments', $data['q_additional_comments'] );
     233        add_post_meta( $post_id, 'Meetup Location', $data['q_mtp_loc'] );
    233234        add_post_meta(
    234235            $post_id, '_status_change', array(
    235236                'timestamp' => time(),
    236                 'user_id'   => is_a( $user, 'WP_User' ) ? $user->ID : 0,
     237                'user_id'   => $wordcamp_user_id,
    237238                'message'   => sprintf( '%s &rarr; %s', 'Application', $statuses[ self::get_default_status() ] ),
    238239            )
Note: See TracChangeset for help on using the changeset viewer.