Ticket #1859: 1859.diff
File 1859.diff, 3.7 KB (added by , 8 years ago) |
---|
-
wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php
428 428 <div class="wcorg-organizer"> 429 429 <h2><?php the_title(); ?></h2> 430 430 <div class="wcorg-organizer-description"> 431 <?php /* Unlike speakers, organizers don't have a Gravatar e-mail field, so we pass the linked user ID to get_avatar */ ?> 432 <?php echo ( $attr['show_avatars'] ) ? get_avatar( absint( get_post_meta( get_the_ID(), '_wcpt_user_id', true ) ), absint( $attr['avatar_size'] ) ) : ''; ?> 431 <?php echo ( $attr['show_avatars'] ) ? get_avatar( get_post_meta( get_the_ID(), '_wcb_organizer_email', true ), absint( $attr['avatar_size'] ) ) : ''; ?> 433 432 <?php the_content(); ?> 434 433 </div> 435 434 </div> … … 1419 1418 */ 1420 1419 function metabox_organizer_info() { 1421 1420 global $post; 1421 $email = get_post_meta( $post->ID, '_wcb_organizer_email', true ); 1422 1422 1423 1423 $wporg_username = ''; 1424 1424 $user_id = get_post_meta( $post->ID, '_wcpt_user_id', true ); … … 1431 1431 <?php wp_nonce_field( 'edit-organizer-info', 'wcpt-meta-organizer-info' ); ?> 1432 1432 1433 1433 <p> 1434 <label for="wcpt-gravatar-email"><?php _e( 'Gravatar Email:', 'wordcamporg' ); ?></label> 1435 <input type="text" class="widefat" id="wcpt-gravatar-email" name="wcpt-gravatar-email" value="<?php echo esc_attr( $email ); ?>" /> 1436 </p> 1437 1438 <p> 1434 1439 <label for="wcpt-wporg-username"><?php _e( 'WordPress.org Username:', 'wordcamporg' ); ?></label> 1435 1440 <input type="text" class="widefat" id="wcpt-wporg-username" name="wcpt-wporg-username" value="<?php echo esc_attr( $wporg_username ); ?>" /> 1436 1441 </p> … … 1672 1677 return; 1673 1678 1674 1679 if ( isset( $_POST['wcpt-meta-organizer-info'] ) && wp_verify_nonce( $_POST['wcpt-meta-organizer-info'], 'edit-organizer-info' ) ) { 1680 $email = sanitize_text_field( $_POST['wcpt-gravatar-email'] ); 1675 1681 $wporg_username = sanitize_text_field( $_POST['wcpt-wporg-username'] ); 1676 1682 $wporg_user = wcorg_get_user_by_canonical_names( $wporg_username ); 1677 1683 1684 if ( empty( $email ) ) 1685 delete_post_meta( $post_id, '_wcb_organizer_email' ); 1686 elseif ( $email && is_email( $email ) ) 1687 update_post_meta( $post_id, '_wcb_organizer_email', $email ); 1688 1678 1689 if ( ! $wporg_user ) 1679 1690 delete_post_meta( $post_id, '_wcpt_user_id' ); 1680 1691 else … … 2009 2020 2010 2021 switch ( $current_filter ) { 2011 2022 case 'manage_wcb_organizer_posts_columns': 2023 $original_columns = $columns; 2024 2012 2025 // Insert at offset 1, that's right after the checkbox. 2013 $columns = array_slice( $columns, 0, 1, true ) + array( 'wcb_organizer_avatar' => __( 'Avatar', 'wordcamporg' ) ) + array_slice( $columns, 1, null, true ); 2026 $columns = array_slice( $original_columns, 0, 1, true ); 2027 $columns += array( 'wcb_organizer_avatar' => __( 'Avatar', 'wordcamporg' ) ); 2028 $columns += array_slice( $original_columns, 1, 1, true ); 2029 $columns += array( 'wcb_organizer_email' => __( 'Gravatar Email', 'wordcamporg' ); 2030 $columns += array_slice( $original_columns, 1, null, true ); 2014 2031 break; 2015 2032 2016 2033 case 'manage_wcb_speaker_posts_columns': … … 2050 2067 edit_post_link( get_avatar( absint( get_post_meta( get_the_ID(), '_wcpt_user_id', true ) ), 32 ) ); 2051 2068 break; 2052 2069 2070 case 'wcb_organizer_email': 2071 echo esc_html( get_post_meta( get_the_ID(), '_wcb_organizer_email', true ) ); 2072 break; 2073 2053 2074 case 'wcb_speaker_avatar': 2054 2075 edit_post_link( get_avatar( get_post_meta( get_the_ID(), '_wcb_speaker_email', true ), 32 ) ); 2055 2076 break;