Skip to:
Content
Pages
Categories
Search
Top
Bottom

group forum slug

  • @georgio-1

    Participant

    Hi,
    I am trying to change the group forum slug. E.g.
    from
    ‘mysite.com/groups/mygroup/forum’
    to
    ‘mysite.com/groups/mygroup/discussion’

    I am using this code:

    function gi_rename_group_slug() {
      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]['forum']['slug'] = 'discussion';
      }
    }
    add_action('bp_init', 'gi_rename_group_slug');

    Unfortunately, nothing happens. What is the error? Thanks in advance.
    —-
    WP 4.8
    bbpress 2.5.12

Viewing 6 replies - 1 through 6 (of 6 total)
  • @robin-w

    Moderator

    silly question, but why not just change it in

    Dashboard>settings>forums>etc.

    and you are using a buddypress hook, not a bbpress one – bbpress is bbp_init and all your code refers to buddypress.

    @triixx

    Participant

    I think because “discussion” is dynamic.

    If you find a solution, i take ! I need similare slug

    @robin-w

    Moderator

    @triixx – not sure what you are asking. The solution is listed in my response

    Dashboard>settings>forums>etc.

    @georgio-1

    Participant

    Dashboard>settings>forums>etc.

    That doesn’t work for my groups. It may work for the first level slug, but I don’t have a sitewide forum to verify. Thanks

    @robin-w

    Moderator

    sorry that sounds buddypress to me, so I’ll back out

    @georgio-1

    Participant

    If you find a solution, i take ! I need similare slug

    Just a workaround:

    //This function changes the text wherever it is quoted

    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'x' ) {
    	$translated_text = 'y';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );

    Give it a try only if you have slugs that are not ordinary words. Unfortunately I cannot use it for forum, since everytime a user writes “forum” it will be translated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar