Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirect after "Join Group"

  • @gabrieldespinoza

    Participant

    Hi, I’m using the latest version of Buddypress and BBpress on my site. The theme I use has a forum within a group.

    When you click on the name of a group, it directs you to the group forum first (which I actually like), however, after clicking “Join Group,” it then redirects from the forum to the group instead of group forum again.

    SO my question is, how can I make to where once a person clicks “join group” it keeps them on the groups forum instead of the group with the activity?

    Thank you.

Viewing 1 replies (of 1 total)
  • @danbp

    Participant

    @gabrieldespinoza,

    this button has two functions: Join group or Leave group and is ajax dependent. So you cannot modify it easily. See /bp-legacy/budypress-functions.php:1157 how it’s done.

    The best approach is to modify the landing page when you go on a group. By default, you go to the group home page.

    Add this to your child-theme functions.php

    
    function bpfr_custom_group_default_tab($default_tab){
    	/**
    	 * class_exists() is recommanded to avoid problems during updates 
    	 * or when Groups Component is deactivated
    	 */
    	if ( class_exists( 'BP_Group_Extension' ) ) : // 
    	
    	$group=groups_get_current_group();//get the current group
    	
    	if(empty($group))
    	return $default_tab;
    	
    	switch($group->slug){
    		
    		case 'XYZ': // group name (slug format)
    		$default_tab='forum';
    		break;
    		
    		case 'another-group': // another group 
    		$default_tab='members'; // goes on a different tab
    		break;
    		
                    // case etc, etc...
    
    		default:		
    		$default_tab='home';// the default landing tab
    		break;
    		
    	}
    	
    	return $default_tab;
    	
    	endif; // class end
    }
    add_filter('bp_groups_default_extension','bpfr_custom_group_default_tab');

    May this help ! 😉

Viewing 1 replies (of 1 total)
  • The topic ‘Redirect after "Join Group"’ is closed to new replies.
Skip to toolbar