Changeset 5015
- Timestamp:
- 07/10/2013 06:54:54 AM (13 years ago)
- Location:
- trunk/includes/admin
- Files:
-
- 2 edited
-
admin.php (modified) (3 diffs)
-
metaboxes.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/admin/admin.php
r5002 r5015 138 138 add_action( 'wp_ajax_bbp_suggest_topic', array( $this, 'suggest_topic' ) ); 139 139 add_action( 'wp_ajax_nopriv_bbp_suggest_topic', array( $this, 'suggest_topic' ) ); 140 141 add_action( 'wp_ajax_bbp_suggest_user', array( $this, 'suggest_user' ) ); 142 add_action( 'wp_ajax_nopriv_bbp_suggest_user', array( $this, 'suggest_user' ) ); 140 143 141 144 /** Filters ***********************************************************/ … … 558 561 $reply_class = sanitize_html_class( bbp_get_reply_post_type() ); 559 562 560 if ( ( 'post' === get_current_screen()->base ) && ( bbp_get_reply_post_type() === get_current_screen()->post_type ) ) : ?> 561 562 <script type="text/javascript"> 563 jQuery(document).ready(function() { 564 565 var bbp_topic_id = jQuery( '#bbp_topic_id' ); 566 567 bbp_topic_id.suggest( ajaxurl + '?action=bbp_suggest_topic', { 568 onSelect: function() { 569 var value = this.value; 570 bbp_topic_id.val( value.substr( 0, value.indexOf( ' ' ) ) ); 571 } 572 } ); 573 }); 574 </script> 575 576 <?php endif; ?> 563 // Post type checker (only topics and replies) 564 if ( 'post' === get_current_screen()->base ) : 565 switch( get_current_screen()->post_type ) : 566 case bbp_get_reply_post_type() : 567 case bbp_get_topic_post_type() : ?> 568 <script type="text/javascript"> 569 jQuery(document).ready(function() { 570 var bbp_author_id = jQuery( '#bbp_author_id' ); 571 bbp_author_id.suggest( ajaxurl + '?action=bbp_suggest_user', { 572 onSelect: function() { 573 var value = this.value; 574 bbp_author_id.val( value.substr( 0, value.indexOf( ' ' ) ) ); 575 } 576 } ); 577 }); 578 579 <?php if ( bbp_get_reply_post_type() == get_current_screen()->post_type ) : ?> 580 jQuery(document).ready(function() { 581 var bbp_topic_id = jQuery( '#bbp_topic_id' ); 582 bbp_topic_id.suggest( ajaxurl + '?action=bbp_suggest_topic', { 583 onSelect: function() { 584 var value = this.value; 585 bbp_topic_id.val( value.substr( 0, value.indexOf( ' ' ) ) ); 586 } 587 } ); 588 }); 589 <?php endif; ?> 590 </script><?php 591 592 break; 593 endswitch; 594 endif; ?> 577 595 578 596 <style type="text/css" media="screen"> … … 1321 1339 if ( ! empty( $topics ) ) { 1322 1340 foreach ( (array) $topics as $post ) { 1323 printf( __( '%s - %s', 'bbpress' ), bbp_get_topic_id( $post->ID ), bbp_get_topic_title( $post->ID ) ) . "\n"; 1341 printf( esc_html__( '%s - %s', 'bbpress' ), bbp_get_topic_id( $post->ID ), bbp_get_topic_title( $post->ID ) . "\n" ); 1342 } 1343 } 1344 die(); 1345 } 1346 1347 /** 1348 * Ajax action for facilitating the topic and reply author auto-suggest 1349 * 1350 * @since bbPress (r5014) 1351 */ 1352 public function suggest_user() { 1353 1354 // Try to get some users 1355 $users_query = new WP_User_Query( array( 1356 'search' => '*' . like_escape( $_REQUEST['q'] ) . '*', 1357 'fields' => array( 'ID', 'user_nicename' ), 1358 'search_columns' => array( 'ID', 'user_nicename', 'user_email' ), 1359 'orderby' => 'ID' 1360 ) ); 1361 1362 // If we found some users, loop through and display them 1363 if ( ! empty( $users_query->results ) ) { 1364 foreach ( (array) $users_query->results as $user ) { 1365 printf( esc_html__( '%s - %s', 'bbpress' ), bbp_get_user_id( $user->ID ), bbp_get_user_nicename( $user->ID, array( 'force' => $user->user_nicename ) ) . "\n" ); 1324 1366 } 1325 1367 } -
trunk/includes/admin/metaboxes.php
r4995 r5015 489 489 490 490 <p> 491 <strong class="label"><?php esc_html_e( 'Name:', 'bbpress' ); ?></strong> 492 <label class="screen-reader-text" for="bbp_author_name"><?php esc_html_e( 'Name', 'bbpress' ); ?></label> 493 <input type="text" id="bbp_author_name" name="bbp_author_name" value="<?php echo esc_attr( get_the_author_meta( 'nicename', bbp_get_global_post_field( 'post_author' ) ) ); ?>" disabled="disabled" /> 494 </p> 495 496 <p> 497 <strong class="label"><?php esc_html_e( 'Email:', 'bbpress' ); ?></strong> 498 <label class="screen-reader-text" for="bbp_author_email"><?php esc_html_e( 'Email', 'bbpress' ); ?></label> 499 <input type="text" id="bbp_author_email" name="bbp_author_email" value="<?php echo esc_attr( get_the_author_meta( 'email', bbp_get_global_post_field( 'post_author' ) ) ); ?>" disabled="disabled" /> 491 <strong class="label"><?php esc_html_e( 'ID:', 'bbpress' ); ?></strong> 492 <label class="screen-reader-text" for="bbp_author_id"><?php esc_html_e( 'ID', 'bbpress' ); ?></label> 493 <input type="text" id="bbp_author_id" name="post_author_override" value="<?php echo esc_attr( bbp_get_global_post_field( 'post_author' ) ); ?>" /> 500 494 </p> 501 495
Note: See TracChangeset
for help on using the changeset viewer.