Ticket #3114: 3114.no-ajax.patch
File 3114.no-ajax.patch, 1.6 KB (added by , 8 years ago) |
---|
-
src/includes/extend/buddypress/groups.php
138 138 // Map group forum activity items to groups 139 139 add_filter( 'bbp_before_record_activity_parse_args', array( $this, 'map_activity_to_group' ) ); 140 140 141 // Add no-ajax for group subscription links 142 add_filter( 'bbp_get_user_subscribe_link', array( $this, 'no_ajax_subscription_link' ) ); 143 141 144 /** Caps **************************************************************/ 142 145 143 146 // Only add these filters if inside a group forum … … 305 308 remove_filter( 'bbp_map_meta_caps', array( $this, 'map_group_forum_meta_caps' ), 99, 4 ); 306 309 } 307 310 311 /** 312 * For subscription links in groups, add 'no-ajax' marker. 313 * 314 * @since 2.6.0 bbPress (rXXXX) 315 */ 316 public function no_ajax_subscription_link( $retval ) { 317 if ( ! bp_is_group() ) { 318 return $retval; 319 } 320 321 $retval = str_replace( '<a href', '<a data-no-ajax="1" href', $retval ); 322 return $retval; 323 } 324 308 325 /** Edit ******************************************************************/ 309 326 310 327 /** -
src/templates/default/js/topic.js
26 26 } ); 27 27 28 28 $( '#subscription-toggle' ).on( 'click', 'span a.subscription-toggle', function( e ) { 29 if ( $( this ).data( 'no-ajax' ) ) { 30 return; 31 } 32 29 33 e.preventDefault(); 30 34 bbp_ajax_call( 'subscription', $( this ).attr( 'data-topic' ), bbpTopicJS.subs_nonce, '#subscription-toggle' ); 31 35 } );