Problem/Motivation

I've encountred this problem using advanced forum module. Comments are not showing up when i switch to another language. This is due to a query alter made by the submodule i18n_select in function i18n_select_query_node_access_alter. This adds a language condition on the node level that prevents the comments select query from getting any result because an inner join is used.

Proposed resolution

I managed to make a custom module that alters the comments select query before being altered by the i18n module.
Just adding the tag "i18n_select" to the query enabled it to bypass the i18n_select node query alter.

/*
 * Fix : Comments are not displayed when switching language
*/
function custom_comment_query_node_access_alter(QueryAlterableInterface $query){
	$tables = $query->getTables();
	foreach ($tables as $table) {
		if (!($table instanceof SelectQueryInterface) && $table['table'] == 'comment') {
			$query->addTag('i18n_select'); // Prevent i18n from altering the query
		}
	}
}

Remaining tasks

I think that i18n_select_query_node_access_alter check conditions must be more precise.

Comments

mohamed.marrouchi created an issue. See original summary.

mohamed.marrouchi’s picture

Issue summary: View changes
Breakerandi’s picture

I have the same problem. Is there any solution without creating a custom module?
I think a lot of people need a multilingual site where comments from a different language are also displayed on other node languages!

francoisb’s picture

In /admin/config/regional/i18n/select
Home » Administration » Configuration » Regional and language » Multilingual settings
under "CONTENT TO FILTER BY LANGUAGE"
can you try to uncheck "Select nodes by language"
and tell if this solved your issue ?

joseph.olstad’s picture

Category: Bug report » Support request
Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

looks like a support request. previous (above) comment appears to be correct.