Changeset 4525
- Timestamp:
- 12/13/2016 08:45:19 PM (10 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt
- Files:
-
- 1 added
- 6 edited
-
javascript/wcpt-wordcamp/admin.js (modified) (3 diffs)
-
mentors/dashboard.php (modified) (5 diffs)
-
views/mentors/dashboard.php (modified) (2 diffs)
-
views/mentors/manage-mentors.php (added)
-
views/mentors/mentors.php (modified) (2 diffs)
-
views/mentors/unmentored-camps.php (modified) (3 diffs)
-
wcpt-wordcamp/wordcamp-admin.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/javascript/wcpt-wordcamp/admin.js
r3158 r4525 10 10 */ 11 11 self.initialize = function() { 12 var createSiteCheckbox = $( '#wcpt_create-site-in-network' ); 12 var createSiteCheckbox = $( '#wcpt_create-site-in-network' ), 13 $mentorUserName = $( '#wcpt_mentor_wordpress_org_user_name' ); 13 14 15 // Sponsor region 14 16 createSiteCheckbox.change( self.toggleSponsorRegionRequired ); 15 17 createSiteCheckbox.trigger( 'change' ); 16 18 19 // Date fields 17 20 $( '.date-field' ).datepicker( { 18 21 dateFormat: 'yy-mm-dd', … … 20 23 changeYear: true 21 24 } ); 25 26 // Mentor username picker 27 if ( $mentorUserName.length && ! $mentorUserName.is( '[readonly]' ) ) { 28 self.initializeMentorPicker( $mentorUserName ); 29 } 22 30 }; 23 31 … … 39 47 }; 40 48 49 /** 50 * Insert a Mentor picker after the Mentor username field. 51 * 52 * @param $el jQuery object for the Mentor username field. 53 */ 54 self.initializeMentorPicker = function( $el ) { 55 if ( 'undefined' === typeof window.wordCampPostType.Mentors.data ) { 56 return; 57 } 58 59 var data = window.wordCampPostType.Mentors.data, 60 l10n = window.wordCampPostType.Mentors.l10n, 61 $select = $( '<select id="wcpt-mentor-picker"><option></option></select>' ), 62 $wrapper = $( '<span class="description">' ), 63 $label = $( '<label>' ).text( l10n.selectLabel ); 64 65 $.each( data, function( key, value ) { 66 var $option = $( '<option>' ); 67 68 $option.val(key) 69 .data({ 70 name: value.name, 71 email: value.email 72 }) 73 .text( value.name ); 74 75 if ( $option.val() === $el.val() ) { 76 $option.prop( 'selected', 'selected' ); 77 } 78 79 $select.append( $option ); 80 }); 81 82 $wrapper.append( $label ) 83 .append( $select ) 84 .insertAfter( $el ); 85 86 // Bind events 87 $select.on( 'change', function() { 88 var $option = $( this ).find( 'option:selected' ); 89 self.updateMentor( $option ); 90 }); 91 }; 92 93 /** 94 * Update the Mentor fields with the data for the mentor chosen in the picker. 95 * 96 * @param $option jQuery object for the selected option element. 97 */ 98 self.updateMentor = function( $option ) { 99 var l10n = window.wordCampPostType.Mentors.l10n, 100 $mentorUserName = $( '#wcpt_mentor_wordpress_org_user_name' ), 101 $mentorName = $( '#wcpt_mentor_name' ), 102 $mentorEmail = $( '#wcpt_mentor_e-mail_address' ); 103 104 // Confirm before changing Mentor field contents 105 if ( $option.val() && confirm( l10n.confirm ) ) { 106 $mentorUserName.val( $option.val() ); 107 $mentorName.val( $option.data('name') ); 108 $mentorEmail.val( $option.data('email') ); 109 } 110 }; 111 112 /** 113 * Kick things off 114 */ 41 115 $( document ).ready( function( $ ) { 42 116 self.initialize(); -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/mentors/dashboard.php
r3727 r4525 3 3 namespace WordCamp\Mentors_Dashboard; 4 4 defined( 'WPINC' ) or die(); 5 6 const USERNAMES_KEY = 'wcpt-mentors-usernames'; 7 const MENTORS_CACHE_KEY = 'wcpt-mentors-data'; 8 9 const STATUS_UPDATED = 'Mentor usernames updated.'; 10 const STATUS_INVALID_NONCE = 'Invalid nonce. Mentor usernames were not updated.'; 11 const STATUS_NO_USERNAME = 'No username data was submitted.'; 12 const STATUS_UPDATE_FAILED = 'Mentor usernames could not be updated.'; 13 14 15 add_action( 'admin_init', __NAMESPACE__ . '\admin_init' ); 16 17 /** 18 * Initialize admin functionality 19 */ 20 function admin_init() { 21 if ( isset( $_GET['wcpt-status'] ) ) { 22 add_action( 'admin_notices', __NAMESPACE__ . '\status_admin_notice' ); 23 } 24 } 5 25 6 26 add_action( 'admin_menu', __NAMESPACE__ . '\add_admin_pages' ); … … 26 46 $mentors = get_mentors(); 27 47 $unmentored_camps = get_unmentored_camps(); 48 $usernames = get_usernames(); 28 49 29 50 require_once( dirname( __DIR__ ) . '/views/mentors/dashboard.php' ); … … 36 57 */ 37 58 function get_mentors() { 38 $mentors = array(); 39 40 $mentored_camps = get_posts( array( 41 'post_type' => WCPT_POST_TYPE_ID, 42 'post_status' => \WordCamp_Loader::get_mentored_post_statuses(), 43 'posts_per_page' => 10000, 44 'meta_query' => array( 45 array( 46 'key' => 'Mentor E-mail Address', 47 'value' => '', 48 'compare' => '!=' 49 ), 50 ), 51 ) ); 52 53 foreach ( $mentored_camps as $camp ) { 54 $email = get_post_meta( $camp->ID, 'Mentor E-mail Address', true ); 55 56 /* 57 * Closed camps were included in the query above, in order to get all mentors, even if they're not 58 * currently mentoring any active camps. Closed camps shouldn't be included in the list of camps being 59 * actively mentored, though. 60 */ 61 $count_camp = 'wcpt-closed' !== $camp->post_status; 62 63 if ( array_key_exists( $email, $mentors ) ) { 64 if ( $count_camp ) { 65 $mentors[ $email ]['camps_mentoring'][] = $camp->post_title; 66 } 67 } else { 68 $mentor_name = get_post_meta( $camp->ID, 'Mentor Name', true ); 69 70 $mentors[ $email ] = array( 71 'name' => $mentor_name, 72 'camps_mentoring' => $count_camp ? array( $camp->post_title ) : array(), 73 ); 74 } 75 } 76 77 return $mentors; 78 } 79 80 /** 81 * Count the total number of camps being mentored 82 * 83 * @param array $mentors 84 * 85 * @return int 86 */ 87 function count_camps_being_mentored( $mentors ) { 88 $camps_being_mentored = 0; 89 90 foreach ( $mentors as $mentor ) { 91 $camps_being_mentored += count( $mentor['camps_mentoring'] ); 92 } 93 94 return $camps_being_mentored; 95 } 96 97 /** 98 * Get active camps that haven't been assigned a mentor 99 * 100 * @return array 101 */ 102 function get_unmentored_camps() { 103 $unmentored_camps = array(); 59 $mentors = get_all_mentor_data(); 60 61 if ( empty( $mentors ) ) { 62 return array(); 63 } 64 65 $mentor_email = wp_list_pluck( $mentors, 'email' ); 104 66 105 67 $post_statuses = array_diff( … … 108 70 ); 109 71 72 $mentored_camps = get_posts( array( 73 'post_type' => WCPT_POST_TYPE_ID, 74 'post_status' => $post_statuses, 75 'posts_per_page' => 10000, 76 'order' => 'ASC', 77 'orderby' => 'name', 78 'meta_query' => array( 79 'relation' => 'OR', 80 array( 81 'key' => 'Mentor WordPress.org User Name', 82 'value' => get_usernames(), 83 'compare' => 'IN', 84 ), 85 array( 86 'key' => 'Mentor E-mail Address', 87 'value' => $mentor_email, 88 'compare' => 'IN', 89 ), 90 ), 91 ) ); 92 93 $mentors = array_map( function( $value ) { 94 $value['camps_mentoring'] = array(); 95 return $value; 96 }, $mentors ); 97 98 foreach ( $mentored_camps as $camp ) { 99 $username = get_post_meta( $camp->ID, 'Mentor WordPress.org User Name', true ); 100 $email = get_post_meta( $camp->ID, 'Mentor E-mail Address', true ); 101 102 // Camp has username 103 if ( false !== $username && isset( $mentors[ $username ] ) ) { 104 $mentors[ $username ]['camps_mentoring'][ $camp->ID ] = $camp->post_title; 105 } 106 // Camp doesn't have username, but has email 107 else if ( false !== $email && false !== $key = array_search( $email, $mentor_email ) ) { 108 // Add asterisk to show camp has mentor email but not username 109 $mentors[ $key ]['camps_mentoring'][ $camp->ID ] = $camp->post_title . ' *'; 110 } 111 } 112 113 return $mentors; 114 } 115 116 /** 117 * Count the total number of camps being mentored 118 * 119 * @param array $mentors 120 * 121 * @return int 122 */ 123 function count_camps_being_mentored( $mentors ) { 124 $camps_being_mentored = 0; 125 126 foreach ( $mentors as $mentor ) { 127 $camps_being_mentored += count( $mentor['camps_mentoring'] ); 128 } 129 130 return $camps_being_mentored; 131 } 132 133 /** 134 * Get active camps that haven't been assigned a mentor 135 * 136 * @return array 137 */ 138 function get_unmentored_camps() { 139 $unmentored_camps = array(); 140 141 $post_statuses = array_diff( 142 \WordCamp_Loader::get_mentored_post_statuses(), 143 array( 'wcpt-closed' ) 144 ); 145 110 146 $posts = get_posts( array( 111 147 'post_type' => WCPT_POST_TYPE_ID, 112 148 'post_status' => $post_statuses, 113 149 'posts_per_page' => 10000, 150 'order' => 'ASC', 151 'orderby' => 'name', 114 152 'meta_query' => array( 153 'relation' => 'OR', 115 154 array( 116 'key' => 'Mentor E-mail Address', 117 'value' => '', 118 'compare' => '=' 155 'key' => 'Mentor WordPress.org User Name', 156 'value' => get_usernames(), 157 'compare' => 'NOT IN' 158 ), 159 array( 160 'key' => 'Mentor WordPress.org User Name', 161 'compare' => 'NOT EXISTS' 119 162 ), 120 163 ), … … 122 165 123 166 foreach ( $posts as $post ) { 124 $unmentored_camps[ $post->ID ] = $post->post_title; 167 $email = get_post_meta( $post->ID, 'Mentor E-mail Address', true ); 168 $camp_name = $post->post_title; 169 170 if ( $email ) { 171 $camp_name .= ' *'; 172 } 173 174 $unmentored_camps[ $post->ID ] = $camp_name; 125 175 } 126 176 127 177 return $unmentored_camps; 128 178 } 179 180 /** 181 * Get the stored array of mentor usernames and sanitize before returning. 182 * 183 * @return array 184 */ 185 function get_usernames() { 186 $raw_usernames = get_site_option( USERNAMES_KEY, array() ); 187 188 return sanitize_usernames( $raw_usernames ); 189 } 190 191 /** 192 * Sanitize a list of usernames and store in the database. 193 * 194 * @param string|array $usernames 195 * 196 * @return bool 197 */ 198 function set_usernames( $usernames ) { 199 $sanitized_usernames = sanitize_usernames( $usernames ); 200 201 return update_site_option( USERNAMES_KEY, $sanitized_usernames ); 202 } 203 204 /** 205 * Sanitize an array of usernames. Convert to an array first if a string is provided. 206 * 207 * @param string|array $usernames 208 * 209 * @return array 210 */ 211 function sanitize_usernames( $usernames ) { 212 if ( ! is_array( $usernames ) ) { 213 $usernames = explode( ',', $usernames ); 214 } 215 216 $usernames = array_map( 'trim', $usernames ); 217 218 $usernames = array_map( 'sanitize_user', $usernames ); 219 220 // Remove empty array items 221 return array_filter( $usernames ); 222 } 223 224 /** 225 * @todo 226 * 227 * @param array $sanitized_usernames 228 */ 229 function validate_usernames( array $sanitized_usernames ) { 230 // todo 231 } 232 233 add_action( 'admin_post_wcpt-mentors-update-usernames', __NAMESPACE__ . '\update_usernames' ); 234 235 /** 236 * Admin Post callback to receive a list of usernames from a form and store it in the database. 237 */ 238 function update_usernames() { 239 // Base redirect URL 240 $redirect_url = add_query_arg( array( 241 'post_type' => 'wordcamp', 242 'page' => 'mentors', 243 ), admin_url( 'edit.php' ) ); 244 245 // Invalid nonce 246 if ( ! isset( $_POST['wcpt-mentors-nonce'] ) || 247 ! wp_verify_nonce( $_POST['wcpt-mentors-nonce'], 'wcpt-mentors-update-usernames' ) ) { 248 $status_code = 'invalid-nonce'; 249 } 250 // No usernames field 251 else if ( ! isset( $_POST['wcpt-mentors-usernames'] ) ) { 252 $status_code = 'no-username'; 253 } 254 // 255 else { 256 $raw_usernames = $_POST['wcpt-mentors-usernames']; 257 258 $success = set_usernames( $raw_usernames ); 259 260 if ( $success ) { 261 $status_code = 'updated'; 262 263 // Bust cache 264 delete_site_transient( MENTORS_CACHE_KEY ); 265 } else { 266 $status_code = 'update-failed'; 267 } 268 } 269 270 $redirect_url = add_query_arg( 'wcpt-status', $status_code, $redirect_url ); 271 272 wp_safe_redirect( esc_url_raw( $redirect_url ) ); 273 } 274 275 /** 276 * Display the result of `update_usernames` 277 */ 278 function status_admin_notice() { 279 if ( ! isset( $_GET['wcpt-status'] ) ) { 280 return; 281 } 282 283 $status = 'STATUS_' . strtoupper( str_replace( '-', '_', $_GET['wcpt-status'] ) ); 284 285 if ( ! defined( __NAMESPACE__ . '\\' . $status ) ) { 286 return; 287 } 288 289 $type = 'success'; 290 if ( 'STATUS_UPDATED' !== $status ) { 291 $type = 'error'; 292 } 293 294 $message = constant( __NAMESPACE__ . '\\' . $status ); 295 296 ?> 297 <div class="notice notice-<?php echo esc_attr( $type ); ?> is-dismissible"> 298 <?php echo wpautop( esc_html( $message ) ); ?> 299 </div> 300 <?php 301 } 302 303 /** 304 * Retrieve name and email for a particular mentor username. 305 * 306 * @param string $username 307 * 308 * @return array 309 */ 310 function get_mentor_data( $username ) { 311 $usernames = get_usernames(); 312 $data = array(); 313 314 // Data for specific mentor 315 if ( in_array( $username, $usernames ) ) { 316 $user = \get_user_by( 'login', $username ); 317 318 if ( $user instanceof \WP_User ) { 319 $data[ $username ] = array( 320 'name' => $user->display_name, 321 'email' => $user->user_email, 322 ); 323 } 324 } 325 326 return $data; 327 } 328 329 /** 330 * Retrieve data for all the mentor usernames in the list. 331 * 332 * @return array 333 */ 334 function get_all_mentor_data() { 335 if ( false !== $data = \get_site_transient( MENTORS_CACHE_KEY ) ) { 336 return $data; 337 } 338 339 $usernames = get_usernames(); 340 $data = array(); 341 342 foreach ( $usernames as $username ) { 343 $data = array_merge( $data, get_mentor_data( $username ) ); 344 } 345 346 ksort( $data ); 347 348 \set_site_transient( MENTORS_CACHE_KEY, $data, WEEK_IN_SECONDS ); 349 350 return $data; 351 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/views/mentors/dashboard.php
r3728 r4525 12 12 <h1>WordCamp Mentors Dashboard</h1> 13 13 14 <p class="description">15 Note: This page doesn't include people who have agreed to be a mentor, but have never been assigned to a16 camp.17 </p>18 19 14 <ul> 20 15 <li>Number of mentors: <?php echo count( $mentors ); ?></li> … … 25 20 <?php require_once( __DIR__ . '/mentors.php' ); ?> 26 21 <?php require_once( __DIR__ . '/unmentored-camps.php' ); ?> 22 <?php require_once( __DIR__ . '/manage-mentors.php' ); ?> 27 23 </div> -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/views/mentors/mentors.php
r3728 r4525 13 13 <thead> 14 14 <th>Mentor</th> 15 <th>Username</th> 15 16 <th>Email Address</th> 16 17 <th># Currently Mentoring</th> 17 <th>C urrently Mentoring</th>18 <th>Camps</th> 18 19 </thead> 19 20 20 21 <tbody> 21 <?php foreach ( $mentors as $ email_address=> $mentor ) : ?>22 <?php foreach ( $mentors as $username => $mentor ) : ?> 22 23 <tr> 23 24 <td><?php echo esc_html( $mentor['name'] ); ?></td> 24 <td><?php echo esc_html( $email_address ); ?></td> 25 <td><?php echo esc_html( $username ); ?></td> 26 <td><?php echo esc_html( $mentor['email'] ); ?></td> 25 27 <td><?php echo count( $mentor['camps_mentoring'] ); ?></td> 26 28 <td> 27 29 <ul> 28 <?php foreach ( $mentor['camps_mentoring'] as $camp ) : ?> 29 <li><?php echo esc_html( $camp ); ?></li> 30 <?php foreach ( $mentor['camps_mentoring'] as $camp_id => $camp_name ) : ?> 31 <li> 32 <a href="<?php echo esc_url( admin_url( "post.php?post=$camp_id&action=edit#wcpt_mentor_wordpress_org_user_name" ) ); ?>"> 33 <?php echo esc_html( $camp_name ); ?> 34 </a> 35 </li> 30 36 <?php endforeach; ?> 31 37 </ul> … … 35 41 </tbody> 36 42 </table> 43 44 <p class="description">(*) Camp has a Mentor email address but not a WordPress.org username.</p> -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/views/mentors/unmentored-camps.php
r3727 r4525 10 10 <h2>Active Camps without a Mentor</h2> 11 11 12 <p class="description">Note: This is based on the <strong>Mentor WordPress.org User Name</strong> field. Some of these camps may have Mentor name and/or email data, but have not yet been updated with the WordPress.org username.</p> 13 12 14 <?php if ( $unmentored_camps ) : ?> 13 15 … … 15 17 <?php foreach ( $unmentored_camps as $id => $name ) : ?> 16 18 <li> 17 <a href="<?php echo esc_url( admin_url( "post.php?post=$id&action=edit " ) ); ?>">19 <a href="<?php echo esc_url( admin_url( "post.php?post=$id&action=edit#wcpt_mentor_wordpress_org_user_name" ) ); ?>"> 18 20 <?php echo esc_html( $name ); ?> 19 21 </a> … … 22 24 </ul> 23 25 26 <p class="description">(*) Camp has a Mentor email address but no WordPress.org username.</p> 27 24 28 <?php else : ?> 25 29 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php
r4404 r4525 1 1 <?php 2 3 use WordCamp\Mentors_Dashboard; 2 4 3 5 if ( ! class_exists( 'WordCamp_Admin' ) ) : … … 37 39 // Scripts and CSS 38 40 add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) ); 39 add_action( 'admin_print_scripts', array( $this, 'admin_print_scripts' ), 99 );40 41 add_action( 'admin_print_styles', array( $this, 'admin_styles' ) ); 41 42 … … 179 180 $post_value = wcpt_key_to_str( $key, 'wcpt_' ); 180 181 $values[ $key ] = isset( $_POST[ $post_value ] ) ? esc_attr( $_POST[ $post_value ] ) : ''; 182 183 // Don't update protected fields 184 if ( self::is_protected_field( $key ) ) { 185 continue; 186 } 181 187 182 188 switch ( $value ) { … … 381 387 'Safety Wrangler Name' => 'text', 382 388 'Safety Wrangler E-mail Address' => 'text', 389 'Mentor WordPress.org User Name' => 'text', 383 390 'Mentor Name' => 'text', 384 391 'Mentor E-mail Address' => 'text', … … 461 468 'Safety Wrangler Name' => 'text', 462 469 'Safety Wrangler E-mail Address' => 'text', 470 'Mentor WordPress.org User Name' => 'text', 463 471 'Mentor Name' => 'text', 464 472 'Mentor E-mail Address' => 'text', … … 484 492 */ 485 493 function admin_scripts() { 486 if ( get_post_type() == WCPT_POST_TYPE_ID ) 487 wp_enqueue_script( 'jquery-ui-datepicker' ); 488 } 489 490 /** 491 * Print our scripts for the Edit WordCamp screen 492 * 493 * If this file grows larger, it'd make sense to switch to using wp_enqueue_script(). 494 */ 495 function admin_print_scripts() { 496 if ( WCPT_POST_TYPE_ID !== get_post_type() ) { 497 return; 498 } 499 500 ?> 501 502 <script> 503 <?php require_once( dirname( __DIR__ ) . '/javascript/wcpt-wordcamp/admin.js' ); ?> 504 </script> 505 506 <?php 494 wp_register_script( 495 'wcpt-admin', 496 WCPT_URL . 'javascript/wcpt-wordcamp/admin.js', 497 array( 'jquery', 'jquery-ui-datepicker' ), 498 WCPT_VERSION, 499 true 500 ); 501 502 // Edit WordCamp screen 503 if ( WCPT_POST_TYPE_ID === get_post_type() ) { 504 wp_enqueue_script( 'wcpt-admin' ); 505 506 // Default data 507 $data = array( 508 'Mentors' => array( 509 'l10n' => array( 510 'selectLabel' => esc_html__( 'Available mentors', 'wordcamporg' ), 511 'confirm' => esc_html__( 'Update Mentor field contents?', 'wordcamporg' ), 512 ), 513 ) 514 ); 515 516 // Only include mentor data if the Mentor username field is editable 517 if ( current_user_can( 'manage_network' ) ) { 518 $data['Mentors']['data'] = Mentors_Dashboard\get_all_mentor_data(); 519 } 520 521 wp_localize_script( 522 'wcpt-admin', 523 'wordCampPostType', 524 $data 525 ); 526 } 507 527 } 508 528 … … 905 925 906 926 /** 927 * Check if a field should be readonly, based on the current user's caps. 928 * 929 * @param string $field_name The field to check. 930 * 931 * @return bool 932 */ 933 public static function is_protected_field( $field_name ) { 934 $protected_fields = array(); 935 936 if ( ! current_user_can( 'manage_network' ) ) { 937 $protected_fields += array( 938 'Mentor WordPress.org User Name', 939 'Mentor Name', 940 'Mentor E-mail Address', 941 ); 942 } 943 944 return in_array( $field_name, $protected_fields ); 945 } 946 947 /** 907 948 * Add our custom admin notice keys to the redirect URL. 908 949 * … … 1083 1124 foreach ( $meta_keys as $key => $value ) : 1084 1125 $object_name = wcpt_key_to_str( $key, 'wcpt_' ); 1126 $readonly = ( WordCamp_Admin::is_protected_field( $key ) ) ? ' readonly="readonly"' : ''; 1085 1127 ?> 1086 1128 … … 1090 1132 <p> 1091 1133 <strong><?php echo $key; ?></strong>: 1092 <input type="checkbox" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" <?php checked( get_post_meta( $post_id, $key, true ) ); ?> />1134 <input type="checkbox" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" <?php checked( get_post_meta( $post_id, $key, true ) ); ?><?php echo $readonly; ?> /> 1093 1135 </p> 1094 1136 … … 1108 1150 case 'text' : ?> 1109 1151 1110 <input type="text" size="36" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" value="<?php echo esc_attr( get_post_meta( $post_id, $key, true ) ); ?>" />1152 <input type="text" size="36" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" value="<?php echo esc_attr( get_post_meta( $post_id, $key, true ) ); ?>"<?php echo $readonly; ?> /> 1111 1153 1112 1154 <?php break; … … 1120 1162 ?> 1121 1163 1122 <input type="text" size="36" class="date-field" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" value="<?php echo $date; ?>" />1164 <input type="text" size="36" class="date-field" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" value="<?php echo $date; ?>"<?php echo $readonly; ?> /> 1123 1165 1124 1166 <?php break; 1125 1167 case 'textarea' : ?> 1126 1168 1127 <textarea rows="4" cols="23" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" ><?php echo esc_attr( get_post_meta( $post_id, $key, true ) ); ?></textarea>1169 <textarea rows="4" cols="23" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>"<?php echo $readonly; ?>><?php echo esc_attr( get_post_meta( $post_id, $key, true ) ); ?></textarea> 1128 1170 1129 1171 <?php break;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)