Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Can't change landing page for groups


  • Iryna_B
    Participant

    @iryna_b

    WP 3.92
    BP 2.1

    Hi, I’m trying to change the landing page for groups to redirect to Forums tab. I used this code, but it didn’t do a thing. I pasted it in functions.php of my child theme.

    
    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');

    Any suggestions of why is it not working?

Viewing 2 replies - 1 through 2 (of 2 total)

  • danbp
    Moderator

    @danbp

    This snippet is working.

    1. Is your functions.php correctly formated ?
    2. XYZ is a fake name. You have to enter one of your group name. As it is a slug format, it is also case sensitive.
    3. Set wp_debug on “true” in wp-config and see if you get error messages

    Iryna_B
    Participant

    @iryna_b

    Thanks! Figured that out!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Can't change landing page for groups’ is closed to new replies.
Skip to toolbar