Skip to:
Content
Pages
Categories
Search
Top
Bottom

Rename Home URL+Slug in BP Group


  • sharmavishal
    Participant

    @sharmavishal

    Hello,

    I would like to rename the Home URL+Slug of a BP Group from “Home” to “Activity”. Tried couple of things but didnt work out. Found the following code on the forum but that doesnt work with latest BP

    function your_bp_groups_forum_first_tab() {
    global $bp;
    
    $bp->bp_options_nav['groups']['home']['name'] = 'Activity';
    $bp->bp_options_nav['groups']['home']['slug'] = 'Activity';
    }
    add_action('wp', 'your_bp_groups_forum_first_tab');

    Kindly help. Any inputs highly appreciated.

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

  • sharmavishal
    Participant

    @sharmavishal

    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/


    danbp
    Participant

    @danbp

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

    sharmavishal
    Participant

    @sharmavishal

    @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


    danbp
    Participant

    @danbp

    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.


    sharmavishal
    Participant

    @sharmavishal

    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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Rename Home URL+Slug in BP Group’ is closed to new replies.
Skip to toolbar