Skip to:

[Resolved] Change JS behavior for request-membership group action button

  • David Cavins


    I’d like to disable the AJAX request for the “request membership” action button in the group directory. At the moment, the same function in buddypress.js catches all group action buttons: join group, leave group and request membership. If, within this function,

    jq('#groups-dir-list').on('click', '.group-button a', function() {…

    I add

    		if ( thelink.hasClass( 'request-membership' ) ) {
    			return true;

    I get the result I want (send the user to the request membership form within the group), but I’m not sure how to do that without altering the core js file.

    I could also remove the class “group-button” in the case of request membership so that the AJAX function wouldn’t catch it. Anyone have a best practices approach for this kind of problem?

    Thanks in advance for your help,


Viewing 1 replies (of 1 total)
  • I solved this by adding the following filter. It removes “group-button” from the button wrapper (only on request membership buttons) so that buddypress.js will ignore the click.

    add_filter( 'bp_get_group_join_button','request_membership_redirect' );
    	 * Change group "Request membership" button behavior-- always redirect to request membership pane, no AJAX requests.
    	public function request_membership_redirect( $button ) {
    		// To prevent buddypress.js from acting on the request membership button click, we'll need to remove the class .group-button from the button wrapper. See buddypress.js line 1252.
    		if ( $button[ 'id' ] == 'request_membership' )
    			$button[ 'wrapper_class' ] = str_replace( 'group-button', '', $button[ 'wrapper_class' ] );
    		return $button;
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Change JS behavior for request-membership group action button’ is closed to new replies.
Skip to toolbar