From 8d89565caa3caedb2e37b0cad5e6468818e180b6 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 9 Aug 2007 19:03:25 +0000 Subject: [PATCH] r1599: Fixed bug://report/97. If a user had selected a language that had since been deleted, the email notification system would fail because the template paths it would try to load wouldn't exist becuase the langcode wouldn't be added. * docs/changes.txt * include/class_notification.php: (NotificationCenter::_localeFromUserId): Instead of checking if the language ID exists for the user, get the langcode for the user's language and check if *that* exists --- docs/changes.txt | 1 + includes/class_notification.php | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index c5f41eb..c4309e9 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -8,6 +8,7 @@ - Fixed: Users could not be approved due to a improper email template paths - Fixed: After mass-updating a search result set, if the search criteria were changed the user would be stuck in a "no results" error (bug://report/93) - Change: Do not show the version number on non-admin pages (bug://report/95) +- Fixed: If a user has set a language that does not exist anymore, then bug notifications would fail (bug://report/97) 1.2.1 =============================== diff --git a/includes/class_notification.php b/includes/class_notification.php index 6309ea8..ce043c7 100644 --- a/includes/class_notification.php +++ b/includes/class_notification.php @@ -616,10 +616,12 @@ class NotificationCenter */ function _localeFromUserId($userid) { - $langid = $this->users[$userid]['languageid']; - $langid = (!$langid ? $this->registry->options['defaultlanguage'] : $langid); - - return $this->registry->datastore['language'][$langid]['langcode']; + $langcode = $this->registry->datastore['language'][$this->users[$userid]['languageid']]['langcode']; + if (!$langcode) + { + $langcode = $this->registry->datastore['language'][$this->registry->options['defaultlanguage']]['langcode']; + } + return $langcode; } } -- 2.22.5