From 0d30adfbb7c5c5ebd9141e27a3e90589377e73a4 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Mon, 12 Nov 2012 03:34:17 +0100 Subject: [PATCH] Added getLanguage method --- .../install/files/lib/data/user/User.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wcfsetup/install/files/lib/data/user/User.class.php b/wcfsetup/install/files/lib/data/user/User.class.php index 64a5d9732f..76bb555704 100644 --- a/wcfsetup/install/files/lib/data/user/User.class.php +++ b/wcfsetup/install/files/lib/data/user/User.class.php @@ -4,6 +4,7 @@ use wcf\data\user\group\UserGroup; use wcf\data\user\UserList; use wcf\data\DatabaseObject; use wcf\system\cache\CacheHandler; +use wcf\system\language\LanguageFactory; use wcf\system\request\IRouteController; use wcf\system\user\storage\UserStorageHandler; use wcf\system\WCF; @@ -353,4 +354,18 @@ final class User extends DatabaseObject implements IRouteController { public function getTitle() { return $this->username; } + + /** + * Returns the language of this user. + * + * @return wcf\data\language\Language + */ + public function getLanguage() { + $language = LanguageFactory::getInstance()->getLanguage($this->languageID); + if ($language === null) { + $language = LanguageFactory::getInstance()->getLanguage(LanguageFactory::getInstance()->getDefaultLanguageID()); + } + + return $language; + } } -- 2.20.1