Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:

Latest Feed, Activity and some other BuddyPress pages show all languages in one go without separation between the langauegs

Solution:

There is a workaround that can be used but it will be a temporary one and it seems that it breaks the pagination but it works as a temporary solution:

// Filter the activity feed by the language:
// 1. buffer the activity entry output...
add_action('bp_before_activity_entry', function () {
    ob_start();
});
// 2. clean the output if the activity is the post activity and languages don't match,
//    flush otherwise.
add_action('bp_after_activity_entry', function () {
    $get_lang = $_GET['lang'];
    $language_code = get_activity_post_language_code();
    if ( $language_code && $get_lang && $language_code !== $get_lang ) {
        ob_end_clean();
    } else {
        ob_end_flush();
    }
});
 
function get_activity_post_language_code() {
    if ( ! bp_get_activity_secondary_item_id() ) {
        return false;
    }
 
    $language_details = apply_filters( 'wpml_post_language_details', NULL, bp_get_activity_secondary_item_id() );
    if ( ! $language_details ) {
        return false;
    }
 
    return $language_details['language_code'];
}

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 17 replies, has 2 voices.

Last updated by Christopher Amirian 1 month, 1 week ago.

Assisted by: Christopher Amirian.

Author Posts
February 21, 2024 at 3:10 pm #15329018

ronnyK-4

I have a Website setup with BuddyBoss Theme, BuddyBoss PLatform Pro, WPML, BuddyPress Multlingual PLug-In. Everything is completly Updated.

In the Activity Feed of each language you see all activities of all languages. Same goes for the Latest Replies and Latest Topics Widgets.

For example on my english site I see my blog Posts in english, german and spanish and same is with latest replies. I see spanish english and german replies in the Sidebar Widget in y english site.

February 22, 2024 at 2:05 pm #15333964

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I checked the debug information you shared and it seems that you use the latest version of WPML and WPML addons, so this might be a compatibility issue that needs to be reported to the compatibility team.

To be able to report the compatibility issues we need to replicate the issue on a clean installation.
I created a clean installation of WordPress, WPML, and all necessary WPML add-ons.
You can access the WordPress dashboard using the link below:
hidden link

Kindly follow the steps below:

- Install The BuddyBoss theme.
- Install the BuddyPress platform plugins.
- Create a few entries and get back to us with the issue with "Activity Feed", "Latest Replies", and "Latest Replies" widgets.

This will help us to report the probable issue to the compatibility team and solve the possible problem faster.

Thanks.

February 22, 2024 at 10:40 pm #15335762

ronnyK-4

As I have only one licencse I cant install BUddyBoss Theme or Pro Platform. Just the free Plugin.

But now you can see when you enter the News Feed site there are latest activities the Post and its spanisch translation.

Latest replies and Topics Widgets are part of Pro stuff so i cant showcase it. Requirements for Developement Environment are
If you need to test or try a recent update from the Buddyboss Theme and BuddyBoss Platform Pro before you put it live on your website, you can install the theme and plugin under any of the following domain keywords without the need for entering a license key:

.test
.dev
staging.
localhost
.local

maybe you guys talk to them so the add .sandbox 😛

February 24, 2024 at 9:34 am #15340063

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Thank you. At least we can check the Activity widget as you mentioned. The thing is that it works as expected and I could not see the issue.

If you check the screenshots, as soon as I set the top admin language to Spanish it shows the Spanish posts and if I switch back to English it shows English posts.

There are a few post items you added in the sandbox which are in another language but they considered as English for WPML as you added that under English language:

hidden link

Do I miss something here?

Screenshot 2024-02-24 at 13.32.00.png
Screenshot 2024-02-24 at 13.32.09.png
February 24, 2024 at 7:01 pm #15340828

ronnyK-4

Hello,

in the Admin view yes but once you open the news-feed page it is not filtered.
hidden link and
hidden link

spanish site.png
english site.png
February 26, 2024 at 3:49 pm #15345203

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Thank you very much. The issue is reported to the compatibility team.

I will update you as soon as I have an answer.

Thanks.

February 26, 2024 at 5:02 pm #15345585

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I have an answer. Unfortunately, it is not possible to differentiate between languages on the feed at the moment.

There is a workaround that can be used but it will be a temporary one and it seems that it breaks the pagination but it works as a temporary solution:

Make a backup of the website.
Add the code below to the functions.php file of your theme or child theme:

// Filter the activity feed by the language:
// 1. buffer the activity entry output...
add_action('bp_before_activity_entry', function () {
	ob_start();
});
// 2. clean the output if the activity is the post activity and languages don't match,
//    flush otherwise.
add_action('bp_after_activity_entry', function () {
	$get_lang = $_GET['lang'];
	$language_code = get_activity_post_language_code();
	if ( $language_code && $get_lang && $language_code !== $get_lang ) {
		ob_end_clean();
	} else {
		ob_end_flush();
	}
});

function get_activity_post_language_code() {
	if ( ! bp_get_activity_secondary_item_id() ) {
		return false;
	}

	$language_details = apply_filters( 'wpml_post_language_details', NULL, bp_get_activity_secondary_item_id() );
	if ( ! $language_details ) {
		return false;
	}

	return $language_details['language_code'];
}

Thanks.

February 26, 2024 at 9:12 pm #15346382

ronnyK-4

I had to replace

$get_lang = $_GET['lang'];

with

$get_lang = apply_filters( 'wpml_current_language', NULL );

I guess the $_GET['lang']; is a parameter in URL but BuddyBoss has to used with slug for language.

There are still the isssues with the Widgets but I will simply write custom ones.

I submitted an Issue wth BBPress before which couldn't be resolved. As BuddyBoss is using BBPress I have the same issue now.

Topics can be translated but the non default language Topics being translated wont show up in the archives. So if I have a Spanish Forum , but default language is english , that Forum displays as empty with the Notice ' No Topics found.'

February 26, 2024 at 9:49 pm #15346588

ronnyK-4

I think I found the error. When translating a Topic the parent forum is set to 'no Forum'. After running the repair tools the parent forum is set correctly.

February 27, 2024 at 12:43 pm #15349144

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I'm glad that the second issue is also handled.

Thanks.

February 27, 2024 at 6:27 pm #15350860

ronnyK-4

Well, it is not really solved as I always have to run the repair tools after publishing or translating a topic in non default language. But for now it works

February 28, 2024 at 1:28 pm #15354102

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Can you replicate the issue on a clean installation below?

hidden link

Also tell us which repair tool you use to fix it. Maybe I can report this to the compatibility team.

Thanks.

March 2, 2024 at 7:17 pm #15366088

ronnyK-4

I added an image.

When running that repair tool. The translated topics appear. When translating probably the latest activity isnt updated.

GHr9uNkWcAA2mgF.jpeg
March 3, 2024 at 4:40 pm #15367035

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

As I am not 100% familiar with the inner works of BuddyBoss you need to give me instructions to see the issue.

Please give me step by step points so I can follow and provide the links so I know what to do and where to see the issue.

Then I will use the repair tool you mentioned to see if it fixes the problem and I will report as a separate one as it seems not related to the previous issue.

Thanks.

March 3, 2024 at 7:12 pm #15367190

ronnyK-4

I usually create a topic in the default language. That one is shown in every place it should be. Parent Forum and Topic Archiv. Then translate the topic. The trnslated topics wont show up anywhere. Not in the Forum they long to nor in the Topics Archiv. Then i run the repair tool and they do show up.

Before running the repair tool, translated topics show up in the Admin dashboard but Forum is set to (no forum).

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.