0

On a multilingual Drupal 7 site, the Language Switcher Block used to work for both published and unpublished nodes.

Example: node/1: English, alias=map, published node/2: German, alias=karte, published node/3: English, alias=table, unpublished node/4: German, alias=tabelle, unpublished

On /node/1 or /map, the Language Switcher shows the link to German and it correctly links to /de/karte. This works also the other way around. However, on /node/3 or /table, the block does show a link to German version, but it links to /de/node/3 instead of /de/tabelle. On the German version at /de/tabelle (or /de/node/4) the block links to /node/4 instead of /table.

As far as I know, this change was introduced between Drupal 7.24 and 7.28 and might even not be a Core issue. However, I couldn't find the source of this behaviour.

Does anyone know, if it is related to some Security Issue with unpublished nodes or where I could start looking further? I tried to find it inside core modules locale/translation and language.inc and also in i18n to no avail.

0

I was finally able to track this change down. The source lies within a security announcement which led to the i18n-7.x-1.11 update. In /sites/all/modules/i18n/i18n_node/i18n_node.module, l. 124 there's a new line reading

'access' => !$matches[2] ? $node_translation->status : NULL,

This line shall prevent unauthorized users from even seeing the path alias of nodes they do not have access to. However, there's no real check of permissions, this line just allows the access based on the node's status. So, even for User 1 (Superadmin) the link to the translated node is inactive if the translation is unpublished.

Whether this is only a temporary fix because of the SA or even supposed to be a permanent solution, I don't know. But that's the way it is right now and if you need to switch between unpublished translations often, you might want to comment that line.

There is already an issue at d.o for that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.