Changeset 7619 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-meetup/class-meetup-application.php
- Timestamp:
- 08/17/2018 09:32:41 AM (8 years ago)
- 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 55 55 return array( 56 56 'wcpt-mtp-nds-vet' => _x( 'Needs Vetting', 'Meetup status', 'wordcamporg' ), 57 'wcpt-mtp-more-info' => _x( 'More Info Requested', 'Meetup status', 'wordcamporg' ),58 57 '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' ), 59 60 'wcpt-mtp-nds-sit' => _x( 'Needs Site', 'Meetup status', 'wordcamporg' ), 60 61 'wcpt-mtp-nds-trn' => _x( 'Needs Transfer', 'Meetup status', 'wordcamporg' ), 61 62 'wcpt-mtp-nds-nw-ow' => _x( 'Needs to assign new owner', 'Meetup status', 'wordcamporg' ), 62 63 'wcpt-mtp-chng-req' => _x( 'Changes requested', 'Meetup status', 'wordcamporg' ), 63 'wcpt-mtp-nds-swag' => _x( 'Needs Swag', 'Meetup status', 'wordcamporg' ),64 64 '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' ), 66 66 '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' ), 68 68 ); 69 69 } … … 129 129 130 130 $required_fields = array( 131 'q_first_name', 132 'q_last_name', 131 'q_name', 133 132 'q_email', 134 133 'q_city', 135 'q_state',136 134 'q_country', 137 'q_ zip',135 'q_mtp_loc', 138 136 'q_already_a_meetup', 139 137 'q_describe_yourself', … … 151 149 foreach ( $required_fields as $field ) { 152 150 if ( empty( $safe_data[ $field ] ) ) { 151 error_log('field is: '. $field); 153 152 return new \WP_Error( 'required_fields', "Please click on your browser's Back button, and fill in all of the required fields." ); 154 153 } … … 166 165 // WordCamp uses an ID with questions. Not sure how are they used. Ask @corey 167 166 $values = array( 168 'q_first_name' => '', 169 'q_last_name' => '', 167 'q_name' => '', 170 168 'q_email' => '', 169 'q_address_line_1' => '', 170 'q_address_line_2' => '', 171 171 'q_city' => '', 172 172 'q_state' => '', 173 173 'q_country' => '', 174 174 'q_zip' => '', 175 'q_mtp_loc' => '', 175 176 'q_already_a_meetup' => '', 176 177 'q_existing_meetup_url' => '', … … 178 179 'q_wporg_username' => '', 179 180 'q_wp_slack_username' => '', 181 'q_additional_comments' => '', 180 182 ); 181 183 … … 192 194 public function create_post( $data ) { 193 195 // 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; 195 197 $statuses = self::get_post_statuses(); 196 198 197 199 $post = array( 198 200 'post_type' => self::get_event_type(), 199 'post_title' => $data['q_city'] . ', ' . $data['q_country'],201 'post_title' => esc_html( $data['q_mtp_loc'] ), 200 202 'post_status' => self::get_default_status(), 201 'post_author' => is_a( $user, 'WP_User' ) ? $user->ID : 0,203 'post_author' => $wordcamp_user_id, 202 204 ); 203 205 … … 211 213 add_post_meta( $post_id, '_application_data', $data ); 212 214 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']} 220 ADDRESS; 221 222 add_post_meta( $post_id, 'Organizer Name', $data['q_name'] ); 221 223 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 ); 226 226 add_post_meta( $post_id, 'Already a meetup', $data['q_already_a_meetup'] ); 227 227 add_post_meta( $post_id, 'Meetup URL', $data['q_existing_meetup_url'] ); 228 228 add_post_meta( $post_id, 'Best describe organizer', $data['q_describe_yourself'] ); 229 229 add_post_meta( $post_id, 'Primary organizer WordPress.org username', $data['q_wporg_username'] ); 230 add_post_meta( $post_id, 'S kype/Slack', $data['q_wp_slack_username'] );230 add_post_meta( $post_id, 'Slack', $data['q_wp_slack_username'] ); 231 231 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'] ); 233 234 add_post_meta( 234 235 $post_id, '_status_change', array( 235 236 'timestamp' => time(), 236 'user_id' => is_a( $user, 'WP_User' ) ? $user->ID : 0,237 'user_id' => $wordcamp_user_id, 237 238 'message' => sprintf( '%s → %s', 'Application', $statuses[ self::get_default_status() ] ), 238 239 )
Note: See TracChangeset
for help on using the changeset viewer.