Changeset 5566
- Timestamp:
- 11/12/2014 07:34:09 PM (10 years ago)
- Location:
- trunk/src/includes/admin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/admin.php
r5565 r5566 697 697 */ 698 698 public function suggest_topic() { 699 global $wpdb; 700 701 // Bail early if no request 702 if ( empty( $_REQUEST['q'] ) ) { 703 wp_die( '0' ); 704 } 705 706 // Check the ajax nonce 707 check_ajax_referer( 'bbp_suggest_topic_nonce' ); 699 708 700 709 // Try to get some topics 701 710 $topics = get_posts( array( 702 's' => like_escape( $_REQUEST['q'] ),711 's' => $wpdb->esc_like( $_REQUEST['q'] ), 703 712 'post_type' => bbp_get_topic_post_type() 704 713 ) ); … … 719 728 */ 720 729 public function suggest_user() { 730 global $wpdb; 731 732 // Bail early if no request 733 if ( empty( $_REQUEST['q'] ) ) { 734 wp_die( '0' ); 735 } 736 737 // Check the ajax nonce 738 check_ajax_referer( 'bbp_suggest_user_nonce' ); 721 739 722 740 // Try to get some users 723 741 $users_query = new WP_User_Query( array( 724 'search' => '*' . like_escape( $_REQUEST['q'] ) . '*',742 'search' => '*' . $wpdb->esc_like( $_REQUEST['q'] ) . '*', 725 743 'fields' => array( 'ID', 'user_nicename' ), 726 744 'search_columns' => array( 'ID', 'user_nicename', 'user_email' ), -
trunk/src/includes/admin/js/common.js
r5225 r5566 3 3 var bbp_author_id = jQuery( '#bbp_author_id' ); 4 4 5 bbp_author_id.suggest( ajaxurl + '?action=bbp_suggest_user', { 6 onSelect: function() { 7 var value = this.value; 8 bbp_author_id.val( value.substr( 0, value.indexOf( ' ' ) ) ); 5 bbp_author_id.suggest( 6 bbp_author_id.data( 'ajax-url' ), 7 { 8 onSelect: function() { 9 var value = this.value; 10 bbp_author_id.val( value.substr( 0, value.indexOf( ' ' ) ) ); 11 } 9 12 } 10 });13 ); 11 14 } ); -
trunk/src/includes/admin/js/replies.js
r5399 r5566 6 6 var bbp_topic_id = jQuery( '#bbp_topic_id' ); 7 7 8 bbp_topic_id.suggest( ajaxurl + '?action=bbp_suggest_topic', { 9 onSelect: function() { 10 var value = this.value; 11 bbp_topic_id.val( value.substr( 0, value.indexOf( ' ' ) ) ); 8 bbp_topic_id.suggest( 9 bbp_topic_id.data( 'ajax-url' ), 10 { 11 onSelect: function() { 12 console.log( 'hi' ); 13 var value = this.value; 14 bbp_topic_id.val( value.substr( 0, value.indexOf( ' ' ) ) ); 15 } 12 16 } 13 });17 ); 14 18 } ); -
trunk/src/includes/admin/metaboxes.php
r5561 r5566 522 522 <strong class="label"><?php esc_html_e( 'Topic:', 'bbpress' ); ?></strong> 523 523 <label class="screen-reader-text" for="parent_id"><?php esc_html_e( 'Topic', 'bbpress' ); ?></label> 524 <input name="parent_id" id="bbp_topic_id" type="text" value="<?php echo esc_attr( $reply_topic_id ); ?>" />524 <input name="parent_id" id="bbp_topic_id" type="text" value="<?php echo esc_attr( $reply_topic_id ); ?>" data-ajax-url="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'bbp_suggest_topic' ), admin_url( 'admin-ajax.php', 'relative' ) ), 'bbp_suggest_topic_nonce' ); ?>" /> 525 525 </p> 526 526 … … 587 587 <strong class="label"><?php esc_html_e( 'ID:', 'bbpress' ); ?></strong> 588 588 <label class="screen-reader-text" for="bbp_author_id"><?php esc_html_e( 'ID', 'bbpress' ); ?></label> 589 <input type="text" id="bbp_author_id" name="post_author_override" value="<?php echo esc_attr( bbp_get_global_post_field( 'post_author' ) ); ?>" />589 <input type="text" id="bbp_author_id" name="post_author_override" value="<?php echo esc_attr( bbp_get_global_post_field( 'post_author' ) ); ?>" data-ajax-url="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'bbp_suggest_user' ), admin_url( 'admin-ajax.php', 'relative' ) ), 'bbp_suggest_user_nonce' ); ?>" /> 590 590 </p> 591 591
Note: See TracChangeset
for help on using the changeset viewer.