Ticket #42937: 42937.1.patch
File 42937.1.patch, 2.4 KB (added by , 7 years ago) |
---|
-
src/wp-admin/includes/ajax-actions.php
985 985 function wp_ajax_add_tag() { 986 986 check_ajax_referer( 'add-tag', '_wpnonce_add-tag' ); 987 987 $taxonomy = ! empty( $_POST['taxonomy'] ) ? $_POST['taxonomy'] : 'post_tag'; 988 $tax = get_taxonomy( $taxonomy ); 988 $tax = get_taxonomy( $taxonomy ); 989 989 990 990 if ( ! current_user_can( $tax->cap->edit_terms ) ) { 991 991 wp_die( -1 ); … … 1023 1023 ob_start(); 1024 1024 $wp_list_table->single_row( $tag ); 1025 1025 $parents = ob_get_clean(); 1026 1026 $message = sprintf( __( 'New %s created. <a href="%s"> View %s </a>' ), $tax->labels->singular_name, get_term_link($tag),$tax->labels->singular_name); 1027 1027 $x->add( 1028 1028 array( 1029 1029 'what' => 'taxonomy', 1030 'data' => $message, 1030 1031 'supplemental' => compact( 'parents', 'noparents' ), 1031 1032 ) 1032 1033 ); -
src/wp-includes/js/wp-ajax-response.js
12 12 return r; 13 13 }, 14 14 parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission 15 var parsed = {}, re = jQuery('#' + r).empty(), err = '' ;15 var parsed = {}, re = jQuery('#' + r).empty(), err = '', successmsg = ''; 16 16 17 17 if ( x && typeof x == 'object' && x.getElementsByTagName('wp_ajax') ) { 18 18 parsed.responses = []; … … 21 21 var th = jQuery(this), child = jQuery(this.firstChild), response; 22 22 response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') }; 23 23 response.data = jQuery( 'response_data', child ).text(); 24 successmsg += response.data; 24 25 response.supplemental = {}; 25 26 if ( !jQuery( 'supplemental', child ).children().each( function() { 26 27 response.supplemental[this.nodeName] = jQuery(this).text(); … … 41 42 parsed.responses.push( response ); 42 43 } ); 43 44 if ( err.length ) { re.html( '<div class="error">' + err + '</div>' ); } 45 else { re.html( '<div class="updated"><p>' + successmsg + '</p></div>'); } 44 46 return parsed; 45 47 } 46 48 if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); }