Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change activity link on a multi language site


  • martijn1972
    Participant

    @martijn1972

    Hi

    I am running Weglot translation plugin. This plugin put a language link behind the url.
    For example if I am using English as the main language and I switch to German it will put ‘/de’ behind the url.

    This gives no problem for all the drop down menu items, but only for the activity link.

    Where in the function files can I change this?

    I would like to add something like this:

    {
    $language = Weglot::Instance()->getCurrentLang();
    if ($language==’en’)
    {$urladd=””;
    }
    else
    {($urladd=”/”.$language);
    }

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

  • martijn1972
    Participant

    @martijn1972

    What’s wrong with the support of Buddypress?
    With every plugin I get reply’s within a few hours, but Buddypress just doesn’t bother to answer questions.

    I would like some help on this and other issues please.

    Hi Martijn-

    I imagine that the reason that no one answered is that none of the volunteers that offer help here knows anything about your specific issue.

    You can change the activity directory link like you were guessing, using the bp_get_activity_directory_permalink filter:

    
    add_filter( 'bp_get_activity_directory_permalink', function ( $url ) {
    	$language = Weglot::Instance()->getCurrentLang();
    	if ( $language != 'en') {
    		$url = $url . '/' . $language;
    	}
    	return $url;
    });
    

    Note that BuddyPress uses the url (and the positions of elements in it, like /members/username/action/subaction) to calculate a number of things, so we can’t say whether the weglot approach will work well with BP.

    Best of luck.


    martijn1972
    Participant

    @martijn1972

    Thanks for your answer.
    In what file should I put this code?
    I just can’t trace the file that handles the links of the dropdown menu


    martijn1972
    Participant

    @martijn1972

    I tried to add this code to the bp-activity-template.php
    It doesn’t work.

    The Wetlot app perfectly works for all the dropdown menu items, but only the first link (the ‘activity’ menu item) returns everyone to the Enlish version.

    Where is that link being handled?


    martijn1972
    Participant

    @martijn1972

    @dcavins could you please help a little more?

    You would add that code to your functions.php file or a site-specific plugin.

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