From 9eff5d958866cd44f379a45b6ce3ec0d5f50496d Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sat, 27 Mar 2010 04:44:54 +0000 Subject: #714190 by rfay: Fixed system_send_email_action() uses account without initializing it. --- modules/system/system.module | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'modules/system') diff --git a/modules/system/system.module b/modules/system/system.module index a8e57d924..aa7ff01db 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -2961,7 +2961,16 @@ function system_send_email_action($entity, $context) { $recipient = token_replace($context['recipient'], $context); - $language = user_preferred_language($account); + // If the recipient is a registered user with a language preference, use + // the recipient's preferred language. Otherwise, use the system default + // language. + $recipient_account = user_load_by_mail($recipient); + if ($recipient_account) { + $language = user_preferred_language($recipient_account); + } + else { + $language = language_default(); + } $params = array('context' => $context); if (drupal_mail('system', 'action_send_email', $recipient, $language, $params)) { -- cgit v1.2.3