User's default language

Permalink
How to get user's default language set in the user profile, backend set in Users table uDefaultLanguage field?

Localization::activeLanguage(); does not bring me that user's default language.

Janks
 
Janks replied on at Permalink Reply
Janks
I made my own function as there is no such in the core code:
function GetUserLocale($UserID) {
    $db = Loader::db();
    $UserLocale = $db->GetOne("SELECT IFNULL(U.uDefaultLanguage, 'None') FROM Users U WHERE U.uID=".$UserID);
    return $UserLocale;
}
mlocati replied on at Permalink Reply
mlocati
There's a way to get the user preferred language:

$u = new \Concrete\Core\User\User();
$userPreferredLanguage = $u->getUserDefaultLanguage();

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.