Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I redirect to Forum Group instead of Home Group from widgets?

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

  • danbp
    Moderator

    @danbp

    Try this snippet, which let’s you determine wich tab you will see first when on a group.

    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 'kill-bill': // group name (use slug format)
    		$default_tab='forum';
    		break;
    		
    		case 'titanic':
    		$default_tab='members';
    		break;
    		
    		default:		
    		$default_tab='home';// the original default landing tab
    		break;
    		
    	}
    	
    	return $default_tab;
    	
    	endif; // end if ( class_exists( 'BP_Group_Extension' ) )
    }
    add_filter('bp_groups_default_extension','bpfr_custom_group_default_tab');

    Comment shane’s function before using this function.


    David13_13
    Participant

    @david13_13

    I have deactivated the shane’s function and added this to functions.php but nothing is happen, default tab is still activity

    Must I change or add something to the code?

    Thanks

    Edit: Ok, I understand now the function. If I use the cases for each individual group it works great, but if I put “forum” in default_tab I get a 404 error when I click on a group:

    default:		
    		$default_tab=‘forum’;// the original default landing tab
    		break;

    David13_13
    Participant

    @david13_13

    Ok, was a problem with the ” in textedit. Works great, thank you!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can I redirect to Forum Group instead of Home Group from widgets?’ is closed to new replies.
Skip to toolbar