Last active
September 22, 2021 00:19
-
-
Save KaineLabs/058f77843254934f1645fdfea943d554 to your computer and use it in GitHub Desktop.
Youzify - BuddyPress Change Group Default Tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Youzify - BuddyPress Change Group Default Tab | |
*/ | |
add_filter('bp_groups_default_extension', 'yz_set_group_default_tab'); | |
function yz_set_group_default_tab(){ | |
$group = groups_get_current_group(); | |
$user_id = bp_loggedin_user_id(); | |
if ( is_object( $group ) && $group->status == 'private' && !groups_is_user_member($user_id, $group->id)) { | |
return 'home'; | |
} | |
return 'info'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment