Skip Navigation

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

Problem:
Using bbPress, topics and Replies are not being displayed on the translated profile pages. The same thing happens when using the shortcode to show forums [bbp-topic-index].

Solution:
- Go to wp-content/plugins/sitepress-multilingual-cms/classes/query-filtering/class-wpml-query-parser.php:418

- Change next function:

	private function maybe_adjust_parent( $q, $post_type, $current_language ) {
		$post_type = ! is_scalar( $post_type ) && count( $post_type ) === 1 ? end( $post_type ) : $post_type;
		if ( ! empty( $q->query_vars['post_parent'] )
		     && $q->query_vars['post_type'] !== 'attachment'
		     && $post_type
		     && is_scalar( $post_type )
		     && $this->sitepress->is_translated_post_type( $post_type )
		) {
			$q->query_vars['post_parent'] = $this->post_translations->element_id_in(
				$q->query_vars['post_parent'],
				$current_language,
				true );
		}

		return $q;
	}

to

	private function maybe_adjust_parent( $q, $post_type, $current_language ) {
		$post_type = ! is_scalar( $post_type ) && count( $post_type ) === 1 ? end( $post_type ) : $post_type;
		if ( ! empty( $q->query_vars['post_parent'] )
		     && $q->query_vars['post_type'] !== 'attachment'
		     && $post_type
		     && $post_type != 'topic'
		     && $post_type != 'reply'
		     && is_scalar( $post_type )
		     && $this->sitepress->is_translated_post_type( $post_type )
		) {
			$q->query_vars['post_parent'] = $this->post_translations->element_id_in(
				$q->query_vars['post_parent'],
				$current_language,
				true );
		}

		return $q;
	}

In the meantime, we are working on a permanent fix that will be included in one of the next WPML versions.

Relevant Documentation:
- https://wpml.org/documentation/related-projects/how-to-use-bbpress-on-multilingual-sites-with-wpml/

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.

This topic contains 8 replies, has 2 voices.

Last updated by Dražen Duvnjak 3 years, 4 months ago.

Assisted by: Dražen Duvnjak.

Author Posts
September 29, 2020 at 7:53 pm #7128635

cyrillek

Hi, following up a first exchange with Rajah, i come back to you having done again the test and got the same result. Here is the details : i'm facing with a problem with bbpress and wpml : the discussions or the topics are not displaying on the forum page and on the profile page for any other language than the default one. To be more precise, on the forums page, normally it should be able to show some threads but it says that there are no threads even when there are, and same thing for discussions and replies pages displayed from the profile. It is working properly on the default language, but not for other languages. Apart from that i am still able to access discussions and replies within a forum by navigating through one forum link on the forums page. We met this issue on buddyboss, and worked together with their support team, to finally find out that the issue happens basically with bbpress and buddypress. Here is a short video made by buddyboss support showing one of these use case scenarios, on a test environment they created for that, with only buddypress/bbpress and wpml activated (i can not reproduce it on my.livha.org as buddyboss is installed and overrides buddypress/bbpress, although i get the same result): hidden link

thanks for your feedback

September 30, 2020 at 6:19 pm #7137593

cyrillek

Hi !
Any feedback on this issue ?
Thanks
Cyrille

October 2, 2020 at 12:52 pm #7151245

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello Cyrille,

sorry for waiting, we have a higher queue these days.

I have reproduced the issue as in the video shared, and escalated this issue to our compatibility team to check and advise.

-

on the forums page, normally it should be able to show some threads

On clean install it shows correctly on the forum page, this looks like an issue specific to your website:

- hidden link
- hidden link

If you still have this issue and since we limit 1 issuer per ticket, I would advise opening a new ticket so we can investigate it further.

I will update you once I have more news on the escalated ticket.

Kind regards,
Drazen

October 2, 2020 at 4:49 pm #7152753

cyrillek

Hi Drazen,
Thanks a lot for your feedback. I'll be looking forward to the feedback regarding this issue. I think that i didn't explain well enough the issue with the topics/replies not displayed on forums page. This is when using the function to display last active topics for instance (i had an enhanced version of the forums page displaying them), i used the shortcode for the purpose of testing [bbp-topic-index].
I had this issue on my main site and also on a test site i created (and buddyboss as well as they also display this info from bbpress), so i guess that you can reproduce it. Here is a quick video showing the issue :
hidden link

Maybe this is linked with the other issues, as it is the same behavior, shall i still create a new ticket for that or do you prefer to add it to this ticket ?
Thank you very much,
Warm regards,
Cyrille

October 5, 2020 at 6:25 am #7161969

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello Cyrille,

thanks for getting back, I can understand the issue now.

I have replicated it and updated our developer working on this case.

Let's see what they will advise, but you are right it looks like a connected issue.

I will update you once I have something new on this issue.

Regards,
Drazen

October 9, 2020 at 6:34 am #7195493

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

our developers checked the issue and came back with a workaround, I tested it and it fixes both issues mentioned.

- Please go to wp-content/plugins/sitepress-multilingual-cms/classes/query-filtering/class-wpml-query-parser.php:418

- Change next function:

	private function maybe_adjust_parent( $q, $post_type, $current_language ) {
		$post_type = ! is_scalar( $post_type ) && count( $post_type ) === 1 ? end( $post_type ) : $post_type;
		if ( ! empty( $q->query_vars['post_parent'] )
		     && $q->query_vars['post_type'] !== 'attachment'
		     && $post_type
		     && is_scalar( $post_type )
		     && $this->sitepress->is_translated_post_type( $post_type )
		) {
			$q->query_vars['post_parent'] = $this->post_translations->element_id_in(
				$q->query_vars['post_parent'],
				$current_language,
				true );
		}

		return $q;
	}

to

	private function maybe_adjust_parent( $q, $post_type, $current_language ) {
		$post_type = ! is_scalar( $post_type ) && count( $post_type ) === 1 ? end( $post_type ) : $post_type;
		if ( ! empty( $q->query_vars['post_parent'] )
		     && $q->query_vars['post_type'] !== 'attachment'
		     && $post_type
		     && $post_type != 'topic'
		     && $post_type != 'reply'
		     && is_scalar( $post_type )
		     && $this->sitepress->is_translated_post_type( $post_type )
		) {
			$q->query_vars['post_parent'] = $this->post_translations->element_id_in(
				$q->query_vars['post_parent'],
				$current_language,
				true );
		}

		return $q;
	}

In the meantime, we are working on a permanent fix that will be included in one of the next WPML versions.

Please let me know how it goes.

Kind regards,
Drazen

October 9, 2020 at 11:57 am #7198277

cyrillek

Thank you so much for this, i changed the code accordingly, and it works perfectly now ! 🙂

December 7, 2020 at 11:06 pm #7611287

cyrillek

Hi, do you know if this will be added as a permanent fix soon ? For now i still have to add it manually after each update of wpml.
Thanks for your feedback

December 8, 2020 at 6:35 am #7612903

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

yes, it will be included but I do not have an ETA for now.

Kind regards,
Drazen

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