Changeset 7619
- Timestamp:
- 08/17/2018 09:32:41 AM (7 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt
- Files:
-
- 7 edited
-
css/applications/meetup.css (modified) (1 diff)
-
views/applications/meetup/shortcode-application.php (modified) (1 diff)
-
wcpt-event/class-event-application.php (modified) (1 diff)
-
wcpt-functions.php (modified) (2 diffs)
-
wcpt-meetup/class-meetup-admin.php (modified) (8 diffs)
-
wcpt-meetup/class-meetup-application.php (modified) (7 diffs)
-
wcpt-wordcamp/class-wordcamp-application.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/css/applications/meetup.css
r7607 r7619 22 22 display: block; 23 23 width: 100%; 24 margin-top: .15em; 24 margin-top: .20em; 25 font-weight: normal; 25 26 } 26 27 28 #meetup-application input[type="submit"] { 29 width: 165px; 30 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/views/applications/meetup/shortcode-application.php
r7607 r7619 14 14 15 15 <form id="meetup-application" method="post"> 16 <label> 17 First Name 18 <span class="required-indicator">(required)</span> 19 <input type="text" name="q_first_name" required/> 20 </label> 16 <div class="PDF_pageInner"> 17 <div class="PDF_questionDivide"></div> 18 <div class="PDF_question"> 19 <label> 20 Please enter your name. 21 <span class="required-indicator">(required)</span> 22 <input type="text" name="q_name" required/> 23 </label> 24 </div> 25 <div class="PDF_questionDivide"></div> 26 <div class="PDF_question"> 27 <label> 28 Please enter you email address. 29 <span class="required-indicator">(required)</span> 30 <input type="email" name="q_email" required/> 31 </label> 32 </div> 33 <div class="PDF_questionDivide"></div> 34 <div class="PDF_question"> 35 <label> Please enter your mailing address (at least your city/state or city/country). </label> 36 <label> 37 Address Line 1 38 <input type="text" name="q_address_line_1"> 39 </label> 40 <label> 41 Address Line 2 42 <input type="text" name="q_address_line_2"> 43 </label> 44 <label> 45 City 46 <span class="required-indicator">(required)</span> 47 <input type="text" name="q_city" required/> 48 </label> 49 <label> 50 State/Province 51 <input type="text" name="q_state"/> 52 </label> 53 <label> 54 Country 55 <span class="required-indicator">(required)</span> 21 56 22 <label> 23 Last Name 24 <span class="required-indicator">(required)</span> 25 <input type="text" name="q_last_name" required/> 26 </label> 57 <select name="q_country" required> 58 <option value=""></option> 27 59 28 <label> 29 Email Address 30 <span class="required-indicator">(required)</span> 31 <input type="email" name="q_email" required/> 32 </label> 60 <?php foreach ( $countries as $country ) : ?> 61 <option value="<?php echo esc_attr( $country['alpha2'] ); ?>"> 62 <?php echo esc_html( $country['name'] ); ?> 63 </option> 64 <?php endforeach; ?> 65 </select> 66 </label> 67 <label> 68 ZIP/Postal Code 69 <input type="text" name="q_zip"/> 70 </label> 71 </div> 72 <div class="PDF_questionDivide"></div> 73 <div class="PDF_question"> 74 <label> 75 Enter the city, state/province, and country where you would like to organize a Meetup 76 <input type="text" name="q_mtp_loc" required/> 77 </label> 78 </div> 79 <div class="PDF_questionDivide"></div> 80 <div class="PDF_question"> 81 <label> 82 Is there already a WordPress meetup group in this city? 83 <span class="required-indicator">(required)</span> 84 <span class="label-description">If you don't know, please <a 85 href="https://www.meetup.com/topics/wordpress/" 86 target="_blank" rel="noopener noreferrer">check Meetup.com</a> first.</span> 33 87 34 <label> 35 City 36 <span class="required-indicator">(required)</span> 37 <input type="text" name="q_city" required/> 38 </label> 88 <select name="q_already_a_meetup" required> 89 <option value=""></option> 90 <option>Nope, no current meetup group</option> 91 <option>Yes, it's the meetup I run now</option> 92 <option>Yes, but I want to do a different kind of meetup</option> 93 </select> 94 </label> 95 </div> 96 <div class="PDF_questionDivide"></div> 97 <div class="PDF_question"> 98 <label> 99 <!-- todo: Show/hide this via JavaScript based on selected answer above --> 100 If there's an existing Meetup.com group, please provide the URL 101 <input type="url" name="q_existing_meetup_url"/> 102 </label> 103 </div> 104 <div class="PDF_questionDivide"></div> 105 <div class="PDF_question"> 106 <label> 107 How would you describe yourself? 108 <span class="required-indicator">(required)</span> 39 109 40 <label> 41 State/Province 42 <span class="required-indicator">(required)</span> 43 <input type="text" name="q_state" required/> 44 </label> 45 46 <label> 47 Country 48 <span class="required-indicator">(required)</span> 49 50 <select name="q_country" required> 51 <option value=""></option> 52 53 <?php foreach ( $countries as $country ) : ?> 54 <option value="<?php echo esc_attr( $country['alpha2'] ); ?>"> 55 <?php echo esc_html( $country['name'] ); ?> 56 </option> 57 <?php endforeach; ?> 58 </select> 59 </label> 60 61 <label> 62 ZIP/Postal Code <span class="required-indicator">(required)</span> 63 <input type="text" name="q_zip" required/> 64 </label> 65 66 <label> 67 Is there already a WordPress meetup group in your city? 68 <span class="required-indicator">(required)</span> 69 <span class="label-description">If you don't know, please <a href="https://www.meetup.com/topics/wordpress/" 70 target="_blank" rel="noopener noreferrer">check Meetup.com</a> first.</span> 71 72 <select name="q_already_a_meetup" required> 73 <option value=""></option> 74 <option>Nope, no current meetup group</option> 75 <option>Yes, it's the meetup I run now</option> 76 <option>Yes, but I want to do a different kind of meetup</option> 77 </select> 78 </label> 79 80 <label> 81 <!-- todo: Show/hide this via JavaScript based on selected answer above --> 82 If there's an existing Meetup.com group, please provide the URL 83 <input type="url" name="q_existing_meetup_url"/> 84 </label> 85 86 <label> 87 How would you describe yourself? 88 <span class="required-indicator">(required)</span> 89 90 <select name="q_describe_yourself" required> 91 <option value=""></option> 92 <option>WordPress professional</option> 93 <option>Current WordPress user or developer</option> 94 <option>New to WordPress</option> 95 <option>I don't use WordPress</option> 96 </select> 97 </label> 98 99 <label> 100 Your <a href="https://wordpress.org" target="_blank">WordPress.org</a> username 101 <span class="required-indicator">(required)</span> 102 <input type="text" name="q_wporg_username" required/> 103 </label> 104 105 <label> 106 Your <a href="https://chat.wordpress.org" target="_blank">WordPress Slack</a> username 107 <input type="text" name="q_wp_slack_username"/> 108 </label> 109 110 <label> 111 Anything you'd like to tell us about yourself, or what you hope to do with a meetup group? 112 <textarea name="slack_username"></textarea> 113 </label> 114 115 <?php submit_button( 'Submit Application', 'primary', 'submit-application' ); ?> 116 110 <select name="q_describe_yourself" required> 111 <option value=""></option> 112 <option>WordPress professional</option> 113 <option>Current WordPress user or developer</option> 114 <option>New to WordPress</option> 115 <option>I don't use WordPress</option> 116 </select> 117 </label> 118 </div> 119 <div class="PDF_questionDivide"></div> 120 <div class="PDF_question"> 121 <label> 122 Your <a href="https://wordpress.org" target="_blank">WordPress.org</a> username 123 <span class="required-indicator">(required)</span> 124 <input type="text" name="q_wporg_username" required/> 125 </label> 126 </div> 127 <div class="PDF_questionDivide"></div> 128 <div class="PDF_question"> 129 <label> 130 Your <a href="https://chat.wordpress.org" target="_blank">WordPress Slack</a> username 131 <input type="text" name="q_wp_slack_username"/> 132 </label> 133 </div> 134 <div class="PDF_questionDivide"></div> 135 <div class="PDF_question"> 136 <label> 137 Anything you'd like to tell us about yourself, or what you hope to do with a meetup group? 138 <textarea name="q_additional_comments"></textarea> 139 </label> 140 </div> 141 <div class="PDF_questionDivide"></div> 142 <div class="PDF_question"> 143 <div class="submit-button"> 144 <?php submit_button( 'Submit Application', 'primary', 'submit-application', false ); ?> 145 </div> 146 </div> 147 </div> 117 148 </form> 118 149 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-event/class-event-application.php
r7607 r7619 40 40 1 41 41 ); 42 42 wp_register_style( 43 'wordcamp-application', 44 plugins_url( 'css/applications/wordcamp.css', __DIR__ ), 45 array( 'wp-community-applications' ), 46 1 47 ); 48 49 wp_enqueue_style( 'wordcamp-application' ); 43 50 wp_enqueue_style( 'wp-community-applications' ); 44 51 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-functions.php
r7607 r7619 66 66 $entries = wcpt_get_log_entries( $post->ID ); 67 67 68 require _once( __DIR__ . '/views/common/metabox-log.php' );68 require( __DIR__ . '/views/common/metabox-log.php' ); 69 69 } 70 70 … … 87 87 88 88 foreach ( array( 'note' => $private_notes, 'status_change' => $status_changes ) as $entry_type => $raw_entries ) { 89 foreach ( $raw_entries as $entry ) {90 $user = get_user_by( 'id', $entry['user_id'] );89 $entries = array_merge( process_raw_entries( $raw_entries, $entry_type ), $entries ); 90 } 91 91 92 if ( $user ) { 93 $entry['user_display_name'] = $user->display_name; 94 } else { 95 // Assume that the action was performed during a cron job 96 $entry['user_display_name'] = 'WordCamp Bot'; 97 } 92 return $entries; 93 } 98 94 99 $entry['type'] = $entry_type; 95 /** 96 * Add displayable data to raw entries 97 * 98 * @param array $raw_entries 99 * @param string $entry_type Type of entry 100 * 101 * @return array 102 */ 103 function process_raw_entries ( $raw_entries, $entry_type ) { 104 $entries = array(); 105 foreach ( $raw_entries as $entry ) { 106 $user = get_user_by( 'id', $entry['user_id'] ); 100 107 101 $entries[] = $entry; 108 if ( $user ) { 109 $entry['user_display_name'] = $user->display_name; 110 } else { 111 // Assume that the action was performed during a cron job 112 $entry['user_display_name'] = 'WordCamp Bot'; 102 113 } 114 115 $entry['type'] = $entry_type; 116 117 $entries[] = $entry; 103 118 } 104 119 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-meetup/class-meetup-admin.php
r7610 r7619 18 18 19 19 /** 20 * Meetup_Admin constructor. 21 */ 22 public function __construct() { 23 parent::__construct(); 24 25 add_action( 'wcpt_metabox_save_done', array( $this, 'save_tag_checkboxes' ) ); 26 } 27 28 /** 20 29 * Return user facing label of event type. 21 30 * … … 75 84 'cb' => '<input type="checkbox" />', 76 85 'title' => __( 'Title', 'wcpt' ), 77 ' swag_needed' => __( 'Swag Needed', 'wcpt' ),86 'tags' => __( 'Tags', 'wcpt' ), 78 87 'organizer' => __( 'Organizer', 'wcpt' ), 79 88 'date' => __( 'Date', 'wcpt' ), … … 116 125 case 'helpscout_url': 117 126 $this->print_clickable_link( get_post_meta( $post_id, 'HelpScout link', true ) ); 118 break;119 case 'swag_needed':120 if ( get_post_meta( $post_id, 'Needs swag', true ) ) {121 echo "<span class='dashicons dashicons-star-filled swag-needed-icon'></span>";122 }123 127 break; 124 128 } … … 186 190 'advanced' 187 191 ); 192 193 add_meta_box( 194 'wcpt_show_tag_logs', 195 'Tag logs', 196 array( $this, 'wcpt_tag_log_metabox' ), 197 $this->get_event_type(), 198 'advanced', 199 'low' 200 ); 201 188 202 } 189 203 … … 248 262 249 263 /** 264 * Renders tags logs 265 */ 266 public function wcpt_tag_log_metabox() { 267 global $post_id; 268 $entries = get_post_meta( $post_id, '_tags_log' ); 269 $entries = process_raw_entries( $entries, 'Tag changed' ); 270 require( WCPT_DIR . '/views/common/metabox-log.php' ); 271 } 272 273 /** 250 274 * Meta keys group for Meetup Event. 251 275 * … … 257 281 258 282 $info_keys = array( 259 'Meetup URL' => 'text', 260 'HelpScout link' => 'text', 261 'City' => 'text', 262 'State' => 'text', 263 'Country' => 'text', 264 'Zip' => 'text', 283 'Meetup URL' => 'text', 284 'HelpScout link' => 'text', 285 'Meetup Location' => 'text', 265 286 ); 266 287 267 288 $application_keys = array( 268 'Date Applied' => 'date', 269 'Date of Last Contact' => 'date', 270 'Who contacted' => 'text', 271 'Vetted Date' => 'date', 272 'Vetted by' => 'text', 273 'Orientation Date' => 'date', 274 'Oriented by' => 'text', 275 'Joined chapter date' => 'date', 276 'Joined chapter by' => 'text', 289 'Date Applied' => 'date', 290 'Already a meetup' => 'text', 291 'Date of Last Contact' => 'date', 292 'Who contacted' => 'text', 293 'Vetted Date' => 'date', 294 'Vetted by' => 'text', 295 'Orientation Date' => 'date', 296 'Oriented by' => 'text', 297 'Joined chapter date' => 'date', 298 'Joined chapter by' => 'text', 299 'More Information requested' => 'checkbox', 300 'Changes Requested' => 'checkbox', 301 'Needs Meeting' => 'checkbox' 277 302 ); 278 303 … … 282 307 'Primary organizer WordPress.org username' => 'text', 283 308 'Co-Organizers usernames (seperated by comma)' => 'text', 309 'Organizer description' => 'text', 284 310 'Date closed' => 'date', 285 'S kype/Slack'=> 'text',311 'Slack' => 'text', 286 312 'Region' => 'text', 287 313 'Address' => 'textarea', 314 'Extra Comments' => 'textarea', 288 315 ); 289 316 … … 317 344 return $data; 318 345 } 346 347 /** 348 * Toggle tags that are rendered as checkboxes 349 * 350 * @param int $post_id 351 */ 352 public function save_tag_checkboxes( $post_id ) { 353 354 $post_tags = wp_get_post_tags( $post_id, array( 'fields' => 'names' ) ); 355 356 $post_tags = $this->add_or_remove_tag( $post_id, $post_tags, 'wcpt_needs_swag', 'Needs Swag', $_POST['wcpt_swag_notes'] ); 357 358 $post_tags = $this->add_or_remove_tag( $post_id, $post_tags, 'wcpt_more_information_requested', 'More Information requested' ); 359 360 $post_tags = $this->add_or_remove_tag( $post_id, $post_tags, 'wcpt_changes_requested', 'Changes Requested' ); 361 362 $post_tags = $this->add_or_remove_tag( $post_id, $post_tags, 'wcpt_needs_meeting', 'Needs Meeting' ); 363 364 if ( $post_tags != wp_get_post_tags( $post_id ) ) { 365 wp_set_post_tags( $post_id, $post_tags ); 366 } 367 } 368 369 /** 370 * Add or remove tag. Also logs and make a note when required 371 * 372 * @param $post_id 373 * @param $tag_array 374 * @param $input_name 375 * @param $label 376 * @param string $note_message 377 * 378 * @return array 379 */ 380 public function add_or_remove_tag( $post_id, $tag_array, $input_name, $label, $note_message = '' ) { 381 382 if ( $note_message !== '' ) { 383 $note_message = ' Note: ' . $note_message; 384 } 385 386 if ( isset( $_POST[ $input_name] ) && $_POST[ $input_name ] && ( ! in_array( $label, $tag_array ) ) ) { 387 388 $tag_array[] = $label; 389 390 add_post_meta( 391 $post_id, '_tags_log', array( 392 'timestamp' => time(), 393 'user_id' => get_current_user_id(), 394 'message' => 'Tag ' . $label . ' added.' . $note_message, 395 ) 396 ); 397 398 } elseif ( ! isset( $_POST[ $input_name] ) && in_array( $label, $tag_array ) ) { 399 $tag_array = array_diff( $tag_array, array( $label ) ); 400 401 add_post_meta( 402 $post_id, '_tags_log', array( 403 'timestamp' => time(), 404 'user_id' => get_current_user_id(), 405 'message' => 'Tag ' . $label . ' removed.' . $note_message, 406 ) 407 ); 408 } 409 410 return $tag_array; 411 } 319 412 } 320 413 -
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 ) -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/class-wordcamp-application.php
r7607 r7619 41 41 ); 42 42 43 wp_register_style(44 'wordcamp-application',45 plugins_url( 'css/applications/wordcamp.css', __DIR__ ),46 array( 'wp-community-applications' ),47 148 );49 50 43 if ( isset( $post->post_content ) && has_shortcode( $post->post_content, self::SHORTCODE_SLUG ) ) { 51 44 wp_enqueue_script( 'wordcamp-application' ); 52 wp_enqueue_style( 'wordcamp-application' );53 45 } 54 46 }
Note: See TracChangeset
for help on using the changeset viewer.