-
Author
-
June 15, 2014 at 03:58 #19808britcunningParticipant
Hey guys,
I want to make the groups page land on “members” tab and remove the home tab.
I was able to successfully edit the group tabs positions with this code
COPY CODEfunction whff_setup_nav() { global $bp; if (isset($bp->groups->current_group->slug) && $bp->groups->current_group->slug == $bp->current_item) { $bp->bp_options_nav[$bp->groups->current_group->slug]['members']['position'] = 10; $bp->bp_options_nav[$bp->groups->current_group->slug]['home']['position'] = 60; $bp->bp_options_nav[$bp->groups->current_group->slug]['admin']['position'] = 110; } } add_action( 'bp_setup_nav', 'whff_setup_nav', 100000 );
Unfortunately the groups page still lands on “Home” even though it is now the second tab.
1) How do I make “Members” the default landing tab for each group
2) How do I remove the “Home” tab completely?I’ve tried variations of
COPY CODEadd_action(‘init’, ‘removeTabs’); function removeTabs() { global $bp; if(isset($bp->bp_nav['home'])) { unset($bp->bp_nav['home']); } }
and
$bp->bp_options_nav['groups']['home'] = false;
but nothing seems to work.
I also tried following the tutorial here: http://themekraft.com/blog/customize-profile-and-group-menus-in-buddypress/ which was also unsuccessful. Can you please help?
Thank you for your time 🙂
June 15, 2014 at 08:24 #19811britcunningParticipantFound code to change the default landing tab for each group.
COPY CODEadd_filter('bp_groups_default_extension','bpdev_custom_group_default_tab'); function bpdev_custom_group_default_tab($default_tab){ $group=groups_get_current_group();//get the current group //if current group is not set, return the default tab if(empty($group)) return $default_tab; // you may create a switch/if else to default to some other tab based on group slug or group id whichever you prefer //here I am testing agains slug switch($group->slug){//to test against group id use $group->id case 'family-law'://the group sug $default_tab='members';//the landing component break; case 'study-group'://the group slug $default_tab='forums';//the landing component break; //go ahead add some more
Still cannot figure out how to unset the “home” tab. Any assistance there would be helpful.
June 19, 2014 at 19:40 #20315AbeKeymasterhi, do it using CSS
COPY CODE#object-nav ul li#home-groups-li { display: none; }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer. -
AuthorPosts
You must be logged in to reply to this topic.