Ticket #3114: 3114.04.patch
File 3114.04.patch, 2.8 KB (added by , 8 years ago) |
---|
-
src/templates/default/bbpress-functions.php
244 244 'bbp_ajaxurl' => bbp_get_ajax_url(), 245 245 'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ), 246 246 'is_user_logged_in' => is_user_logged_in(), 247 'subs_nonce' => wp_create_nonce( 'toggle-subscription_' . get_the_ID() )248 247 ) ); 249 248 250 249 // Single topic … … 254 253 'bbp_ajaxurl' => bbp_get_ajax_url(), 255 254 'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ), 256 255 'is_user_logged_in' => is_user_logged_in(), 257 'fav_nonce' => wp_create_nonce( 'toggle-favorite_' . get_the_ID() ),258 'subs_nonce' => wp_create_nonce( 'toggle-subscription_' . get_the_ID() )259 256 ) ); 260 257 } 261 258 } -
src/templates/default/js/forum.js
21 21 } 22 22 23 23 $( '#subscription-toggle' ).on( 'click', 'span a.subscription-toggle', function( e ) { 24 var nonce = ( bbpForumJS.forum_id === 0 ) ? $( this ).data( 'bbp-nonce' ) : bbpForumJS.subs_nonce;25 26 24 e.preventDefault(); 27 bbp_ajax_call( 'forum_subscription', $( this ).attr( 'data-forum' ), nonce, '#subscription-toggle' );25 bbp_ajax_call( 'forum_subscription', $( this ).attr( 'data-forum' ), $( this ).data( 'bbp-nonce' ), '#subscription-toggle' ); 28 26 } ); 29 27 } ); -
src/templates/default/js/topic.js
21 21 } 22 22 23 23 $( '#favorite-toggle' ).on( 'click', 'span a.favorite-toggle', function( e ) { 24 var nonce = ( bbpTopicJS.topic_id === 0 ) ? $( this ).data( 'bbp-nonce' ) : bbpTopicJS.fav_nonce;25 26 24 e.preventDefault(); 27 bbp_ajax_call( 'favorite', $( this ).attr( 'data-topic' ), nonce, '#favorite-toggle' );25 bbp_ajax_call( 'favorite', $( this ).attr( 'data-topic' ), $( this ).data( 'bbp-nonce' ), '#favorite-toggle' ); 28 26 } ); 29 27 30 28 $( '#subscription-toggle' ).on( 'click', 'span a.subscription-toggle', function( e ) { 31 var nonce = ( bbpTopicJS.topic_id === 0 ) ? $( this ).data( 'bbp-nonce' ) : bbpTopicJS.subs_nonce;32 33 29 e.preventDefault(); 34 bbp_ajax_call( 'subscription', $( this ).attr( 'data-topic' ), nonce, '#subscription-toggle' );30 bbp_ajax_call( 'subscription', $( this ).attr( 'data-topic' ), $( this ).data( 'bbp-nonce' ), '#subscription-toggle' ); 35 31 } ); 36 32 37 33 $( '.bbp-alert-outer' ).on( 'click', '.bbp-alert-close', function( e ) {