The 'node-url' token is used by notifications to point users to the node that was added or changed. Without this patch, it always gives a URL with the sites default language.

For example, if you are using domain based language negotiation for a site in both English and Spanish, with URLs http://en.example.com and http://es.example.com, and your default is English, it will always return http://en.example.com/node/123 even if the user in question has Spanish set as their default language.

This patch fixes this problem by looking for the language passed in $options to node_token_values(), which is where notifications passes the user's language.

Please let me know what you think!

Regards,
David.

CommentFileSizeAuthor
#5 node-url-language.patch854 bytesdsnopek
node-url-language.patch791 bytesdsnopek
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, node-url-language.patch, failed testing.

dsnopek’s picture

Status: Needs work » Needs review

Hrm. I don't know what that was about! In the log it says "Applied patch token_node.inc cleanly" and then a couple lines later: "This may be a -p0 (old style) patch, which is no longer supported by the testbots".

I really don't know why the testbot tries to run for some projects and not others? I contribute tons of patchs but only sometimes the testbot fires. And apparently I shouldn't be making -p0 patches?

Well, hopefully it will let it be the second time..

Dave Reid’s picture

Status: Needs review » Needs work

You should be using 'git diff' to make the patches from Git repository clones.

Dave Reid’s picture

Where in the notification module does it call token_replace() with the $options['language'] parameter? Because if we want to support this then $options['language'] should be an object just like the D7 token API supports $options['language'].

dsnopek’s picture

Status: Needs work » Needs review
FileSize
854 bytes

Sorry for the super late reply! I got distracted away from the site where this was an issue and FINALLY got a chance to come back to it.

It isn't in the 'notifications' module but in 'messaging' because these tokens are actually expanded in the messaging templates - sorry for the confusion. See the messaging_template_text_replace() function in the messaging_template/messaging_template.module. Note that this is actually a language object, not just the code.

Attached is a new patch made with 'git diff'.

Best regards,
David.

Status: Needs review » Needs work

The last submitted patch, node-url-language.patch, failed testing.

dsnopek’s picture

Status: Needs work » Needs review

Gah! I can't seem to get a hang of the testbot. This patch is against a fresh clone of the 6.x-1.x branch. It was created with 'git diff' per the instruction here. Not sure what I'm still doing wrong...