Skip to:
Content

bbPress.org

Ticket #3114: 3114.04.patch

File 3114.04.patch, 2.8 KB (added by r-a-y, 8 years ago)
  • src/templates/default/bbpress-functions.php

     
    244244                                'bbp_ajaxurl'        => bbp_get_ajax_url(),
    245245                                'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ),
    246246                                'is_user_logged_in'  => is_user_logged_in(),
    247                                 'subs_nonce'         => wp_create_nonce( 'toggle-subscription_' . get_the_ID() )
    248247                        ) );
    249248
    250249                // Single topic
     
    254253                                'bbp_ajaxurl'        => bbp_get_ajax_url(),
    255254                                'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ),
    256255                                '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() )
    259256                        ) );
    260257                }
    261258        }
  • src/templates/default/js/forum.js

     
    2121        }
    2222
    2323        $( '#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 
    2624                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' );
    2826        } );
    2927} );
  • src/templates/default/js/topic.js

     
    2121        }
    2222
    2323        $( '#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 
    2624                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' );
    2826        } );
    2927
    3028        $( '#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 
    3329                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' );
    3531        } );
    3632
    3733        $( '.bbp-alert-outer' ).on( 'click', '.bbp-alert-close', function( e ) {