I was able to change the slug using the following code
$bp->bp_options_nav[$bp->groups->current_group->slug]['home']['name'] = 'Activity';
how do i change the URL from domain.com/groups/groupname/home/ to domain.com/groups/groupname/activity/
IMO, you’re strugling with something unnecessary.
The group home tab shows the group activity by default and URL when on this page is domain.com/groups/groupname/
Groups
Your function is ok and it is not necessary to add /activity/ to the original slug. The action name for group activity page is home
. If you add it manually to ‘domain.com/groups/groupname/home’, home will be stripped by default. And if you change home to xyz, you’ll get a 404 error.
Renaming the tab to a more accurate string is possible of course. Changing the group activity URL isn’t.
function my_bp_groups_default_tab() {
global $bp;
$bp->bp_options_nav[$bp->groups->current_group->slug]['home']['name'] = 'Group Activity';
}
add_action('bp_groups_setup_nav', 'my_bp_groups_default_tab');
@danbp thanks for your reply. its highly appreciated. I understand its bit unnecessary.
Am using a custom home page via BuddyPress Groups Extras. So on my site the home page for groups is gpages which doesnt have a slug in the URL which is great.
now my second tab is “Home” which i renamed to “Activity”. This is also fine. But the slug of Activity page is “home”. so when i click on the activity tab the URL in the broswer shows group/name/home.
I believe the previous versions of BP the home page was actually named as Activity right?
the only way i can fix this is via hacking the core BP file bp-groups-loader.php
// Add the "Home" subnav item, as this will always be present
$sub_nav[] = array(
'name' => _x( 'Activity', 'Group screen navigation title', 'buddypress' ),
'slug' => 'activity',
Thanks once again
Hi @sharmavishal,
i would rather try to modify BP Group Extras, as it is this plugin who generate the “not great” slug.
If you have coding experience, you could try to hook into BPGE, or at least ask @slaffik how to do this.
Thanks a lot @danbp ..BP Group Extras is not generating any slug..thats working fine….i will check again on this in details…thanks once again