Changeset 6541
- Timestamp:
- 06/13/2017 07:38:48 PM (8 years ago)
- Location:
- trunk/src/templates/default
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/templates/default/bbpress-functions.php
r6498 r6541 225 225 * @uses bbp_is_single_forum() To check if it's the forum page 226 226 * @uses bbp_is_single_topic() To check if it's the topic page 227 * @uses is_user_logged_in() To check if user is logged in228 * @uses bbp_get_current_user_id() To get the current user id229 * @uses bbp_get_forum_id() To get the forum id230 * @uses bbp_get_topic_id() To get the topic id231 * @uses bbp_get_favorites_permalink() To get the favorites permalink232 * @uses bbp_is_user_favorite() To check if the topic is in user's favorites233 * @uses bbp_is_subscriptions_active() To check if the subscriptions are active234 * @uses bbp_is_user_subscribed() To check if the user is subscribed to topic235 * @uses bbp_get_topic_permalink() To get the topic permalink236 227 * @uses wp_localize_script() To localize the script 237 228 */ … … 244 235 'bbp_ajaxurl' => bbp_get_ajax_url(), 245 236 'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ), 246 'is_user_logged_in' => is_user_logged_in(),247 'subs_nonce' => wp_create_nonce( 'toggle-subscription_' . get_the_ID() )248 237 ) ); 249 238 … … 254 243 'bbp_ajaxurl' => bbp_get_ajax_url(), 255 244 'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ), 256 '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 245 ) ); 260 246 } -
trunk/src/templates/default/js/forum.js
r6540 r6541 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 } ); -
trunk/src/templates/default/js/topic.js
r6540 r6541 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
Note: See TracChangeset
for help on using the changeset viewer.