Index: src/includes/users/template.php
--- src/includes/users/template.php Base (BASE)
+++ src/includes/users/template.php Locally Modified (Based On LOCAL)
@@ -1202,10 +1202,25 @@
 			$permalink = get_permalink();
 		}
 
-		$url  = esc_url( wp_nonce_url( add_query_arg( $query_args, $permalink ), 'toggle-favorite_' . $topic_id ) );
-		$sub  = $is_fav ? ' class="is-favorite"' : '';
-		$html = sprintf( '%s<span id="favorite-%d"  %s><a href="%s" class="favorite-toggle" data-topic="%d" data-bbp-nonce="%s">%s</a></span>%s', $r['before'], $topic_id, $sub, $url, $topic_id, wp_create_nonce( 'toggle-favorite_' . $topic_id ), $text, $r['after'] );
+		$object_id = $topic_id;
 
+		// Nonce
+		$query_args['_wpnonce'] = wp_create_nonce( 'toggle-favorite_' . $object_id );
+
+		// URL
+		$html = sprintf(
+			'%s<span id="favorite-%d"  %s><a href="%s" class="favorite-toggle" data-bbp-object-id="%d" data-bbp-nonce="%s" data-bbp-ajax-url="%s">%s</a></span>%s',
+			$r['before'],
+			$object_id,
+			$is_fav ? ' class="is-favorite"' : '',
+			esc_url( add_query_arg( $query_args, $permalink ) ),
+			$object_id,
+			$query_args['_wpnonce'],
+			bbp_get_ajax_url(),
+			$text,
+			$r['after']
+		);
+
 		// Initial output is wrapped in a span, ajax output is hooked to this
 		if ( ! empty( $wrap ) ) {
 			$html = '<span id="favorite-toggle">' . $html . '</span>';
@@ -1354,7 +1369,7 @@
 
 		// Bail if subscriptions are inactive
 		if ( ! bbp_is_subscriptions_active() ) {
-			return;
+			return false;
 		}
 
 		// Parse arguments against default values
@@ -1386,6 +1401,7 @@
 		if ( empty( $topic_id ) && ! empty( $forum_id ) ) {
 
 			// Decide which link to show
+			$object_id     = $forum_id;
 			$is_subscribed = bbp_is_user_subscribed_to_forum( $user_id, $forum_id );
 			if ( ! empty( $is_subscribed ) ) {
 				$text       = $r['unsubscribe'];
@@ -1395,11 +1411,6 @@
 				$query_args = array( 'action' => 'bbp_subscribe',   'forum_id' => $forum_id );
 			}
 
-			// Custom redirect
-			if ( ! empty( $r['redirect_to'] ) ) {
-				$query_args['redirect_to'] = urlencode( $r['redirect_to'] );
-			}
-
 			// Create the link based where the user is and if the user is
 			// subscribed already
 			if ( bbp_is_subscriptions() ) {
@@ -1410,18 +1421,10 @@
 				$permalink = get_permalink();
 			}
 
-			$url  = esc_url( wp_nonce_url( add_query_arg( $query_args, $permalink ), 'toggle-subscription_' . $forum_id ) );
-			$sub  = $is_subscribed ? ' class="is-subscribed"' : '';
-			$html = sprintf( '%s<span id="subscribe-%d"  %s><a href="%s" class="subscription-toggle" data-forum="%d" data-bbp-nonce="%s">%s</a></span>%s', $r['before'], $forum_id, $sub, $url, $forum_id, wp_create_nonce( 'toggle-subscription_' . $forum_id ), $text, $r['after'] );
-
-			// Initial output is wrapped in a span, ajax output is hooked to this
-			if ( ! empty( $wrap ) ) {
-				$html = '<span id="subscription-toggle">' . $html . '</span>';
-			}
-
 		} else {
 
 			// Decide which link to show
+			$object_id     = $topic_id;
 			$is_subscribed = bbp_is_user_subscribed_to_topic( $user_id, $topic_id );
 			if ( ! empty( $is_subscribed ) ) {
 				$text       = $r['unsubscribe'];
@@ -1431,11 +1434,6 @@
 				$query_args = array( 'action' => 'bbp_subscribe',   'topic_id' => $topic_id );
 			}
 
-			// Custom redirect
-			if ( ! empty( $r['redirect_to'] ) ) {
-				$query_args['redirect_to'] = urlencode( $r['redirect_to'] );
-			}
-
 			// Create the link based where the user is and if the user is
 			// subscribed already
 			if ( bbp_is_subscriptions() ) {
@@ -1445,15 +1443,33 @@
 			} else {
 				$permalink = get_permalink();
 			}
+		}
 
-			$url  = esc_url( wp_nonce_url( add_query_arg( $query_args, $permalink ), 'toggle-subscription_' . $topic_id ) );
-			$sub  = $is_subscribed ? ' class="is-subscribed"' : '';
-			$html = sprintf( '%s<span id="subscribe-%d"  %s><a href="%s" class="subscription-toggle" data-topic="%d" data-bbp-nonce="%s">%s</a></span>%s', $r['before'], $topic_id, $sub, $url, $topic_id, wp_create_nonce( 'toggle-subscription_' . $topic_id ), $text, $r['after'] );
+		// Custom redirect
+		if ( ! empty( $r['redirect_to'] ) ) {
+			$query_args['redirect_to'] = urlencode( $r['redirect_to'] );
+		}
 
-			// Initial output is wrapped in a span, ajax output is hooked to this
-			if ( ! empty( $wrap ) ) {
-				$html = '<span id="subscription-toggle">' . $html . '</span>';
-			}
+		// Nonce
+		$query_args['_wpnonce'] = wp_create_nonce( 'toggle-subscription_' . $object_id );
+
+		// URL
+		$html = sprintf(
+			'%s<span id="subscribe-%d"  %s><a href="%s" class="subscription-toggle" data-bbp-object-id="%d" data-bbp-nonce="%s" data-bbp-ajax-url="%s">%s</a></span>%s',
+			$r['before'],
+			$object_id,
+			$is_subscribed ? ' class="is-subscribed"' : '',
+			esc_url( add_query_arg( $query_args, $permalink ) ),
+			$object_id,
+			$query_args['_wpnonce'],
+			bbp_get_ajax_url(),
+			$text,
+			$r['after']
+		);
+
+		// Initial output is wrapped in a span, ajax output is hooked to this
+		if ( ! empty( $wrap ) ) {
+			$html = '<span id="subscription-toggle">' . $html . '</span>';
 		}
 
 		// Filter & return
Index: src/templates/default/bbpress-functions.php
--- src/templates/default/bbpress-functions.php Base (BASE)
+++ src/templates/default/bbpress-functions.php Locally Modified (Based On LOCAL)
@@ -221,41 +221,22 @@
 	 * These localizations require information that may not be loaded even by init.
 	 *
 	 * @since 2.1.0 bbPress (r3732)
+	 * @since 2.6.0 bbPress (r6540) Moved vars from here to data attributes
 	 *
-	 * @uses bbp_is_single_forum() To check if it's the forum page
-	 * @uses bbp_is_single_topic() To check if it's the topic page
-	 * @uses is_user_logged_in() To check if user is logged in
-	 * @uses bbp_get_current_user_id() To get the current user id
-	 * @uses bbp_get_forum_id() To get the forum id
-	 * @uses bbp_get_topic_id() To get the topic id
-	 * @uses bbp_get_favorites_permalink() To get the favorites permalink
-	 * @uses bbp_is_user_favorite() To check if the topic is in user's favorites
-	 * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
-	 * @uses bbp_is_user_subscribed() To check if the user is subscribed to topic
-	 * @uses bbp_get_topic_permalink() To get the topic permalink
-	 * @uses wp_localize_script() To localize the script
+	 * @uses wp_localize_script() To localize strings
 	 */
 	public function localize_topic_script() {
 
 		// Single forum
 		if ( bbp_is_single_forum() ) {
 			wp_localize_script( 'bbpress-forum', 'bbpForumJS', array(
-				'forum_id'           => get_the_ID(),
-				'bbp_ajaxurl'        => bbp_get_ajax_url(),
-				'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ),
-				'is_user_logged_in'  => is_user_logged_in(),
-				'subs_nonce'         => wp_create_nonce( 'toggle-subscription_' . get_the_ID() )
+				'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' )
 			) );
 
 		// Single topic
 		} elseif ( bbp_is_single_topic() ) {
 			wp_localize_script( 'bbpress-topic', 'bbpTopicJS', array(
-				'topic_id'           => get_the_ID(),
-				'bbp_ajaxurl'        => bbp_get_ajax_url(),
-				'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ),
-				'is_user_logged_in'  => is_user_logged_in(),
-				'fav_nonce'          => wp_create_nonce( 'toggle-favorite_' .     get_the_ID() ),
-				'subs_nonce'         => wp_create_nonce( 'toggle-subscription_' . get_the_ID() )
+				'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' )
 			) );
 		}
 	}
Index: src/templates/default/js/forum.js
--- src/templates/default/js/forum.js Base (BASE)
+++ src/templates/default/js/forum.js Locally Modified (Based On LOCAL)
@@ -1,14 +1,8 @@
 /* global bbpForumJS */
 jQuery( document ).ready( function ( $ ) {
 
-	function bbp_ajax_call( action, forum_id, nonce, update_selector ) {
-		var $data = {
-			action : action,
-			id     : forum_id,
-			nonce  : nonce
-		};
-
-		$.post( bbpForumJS.bbp_ajaxurl, $data, function ( response ) {
+	function bbp_ajax_call( url, data, update_selector ) {
+		$.post( url, data, function ( response ) {
 			if ( response.success ) {
 				$( update_selector ).html( response.content );
 			} else {
@@ -21,9 +15,15 @@
 	}
 
 	$( '#subscription-toggle' ).on( 'click', 'span a.subscription-toggle', function( e ) {
-		var nonce = ( bbpForumJS.forum_id === 0 ) ? $( this ).data( 'bbp-nonce' ) : bbpForumJS.subs_nonce;
-
 		e.preventDefault();
-		bbp_ajax_call( 'forum_subscription', $( this ).attr( 'data-forum' ), nonce, '#subscription-toggle' );
+		bbp_ajax_call(
+			$( this ).data( 'bbp-ajax-url' ),
+			{
+				action : 'forum_subscription',
+				id     : $( this ).data( 'bbp-object-id' ),
+				nonce  : $( this ).data( 'bbp-nonce'     )
+			},
+			'#subscription-toggle'
+		);
 	} );
 } );
Index: src/templates/default/js/topic.js
--- src/templates/default/js/topic.js Base (BASE)
+++ src/templates/default/js/topic.js Locally Modified (Based On LOCAL)
@@ -1,19 +1,13 @@
 /* global bbpTopicJS */
 jQuery( document ).ready( function ( $ ) {
 
-	function bbp_ajax_call( action, topic_id, nonce, update_selector ) {
-		var $data = {
-			action : action,
-			id     : topic_id,
-			nonce  : nonce
-		};
-
-		$.post( bbpTopicJS.bbp_ajaxurl, $data, function ( response ) {
+	function bbp_ajax_call( url, data, update_selector ) {
+		$.post( url, data, function ( response ) {
 			if ( response.success ) {
 				$( update_selector ).html( response.content );
 			} else {
 				if ( !response.content ) {
-					response.content = bbpTopicJS.generic_ajax_error;
+					response.content = bbpForumJS.generic_ajax_error;
 				}
 				window.alert( response.content );
 			}
@@ -21,17 +15,29 @@
 	}
 
 	$( '#favorite-toggle' ).on( 'click', 'span a.favorite-toggle', function( e ) {
-		var nonce = ( bbpTopicJS.topic_id === 0 ) ? $( this ).data( 'bbp-nonce' ) : bbpTopicJS.fav_nonce;
-
 		e.preventDefault();
-		bbp_ajax_call( 'favorite', $( this ).attr( 'data-topic' ), nonce, '#favorite-toggle' );
+		bbp_ajax_call(
+			$( this ).data( 'bbp-ajax-url' ),
+			{
+				action : 'favorite',
+				id     : $( this ).data( 'bbp-object-id' ),
+				nonce  : $( this ).data( 'bbp-nonce'     )
+			},
+			'#favorite-toggle'
+		);
 	} );
 
 	$( '#subscription-toggle' ).on( 'click', 'span a.subscription-toggle', function( e ) {
-		var nonce = ( bbpTopicJS.topic_id === 0 ) ? $( this ).data( 'bbp-nonce' ) : bbpTopicJS.subs_nonce;
-
 		e.preventDefault();
-		bbp_ajax_call( 'subscription', $( this ).attr( 'data-topic' ), nonce, '#subscription-toggle' );
+		bbp_ajax_call(
+			$( this ).data( 'bbp-ajax-url' ),
+			{
+				action : 'subscription',
+				id     : $( this ).data( 'bbp-object-id' ),
+				nonce  : $( this ).data( 'bbp-nonce'     )
+			},
+			'#subscription-toggle'
+		);
 	} );
 
 	$( '.bbp-alert-outer' ).on( 'click', '.bbp-alert-close', function( e ) {
