From c86865bc6176c595ffd9e4566bb2094f4d62ccd2 Mon Sep 17 00:00:00 2001 From: grandeljay Date: Thu, 22 Sep 2022 10:58:43 +0200 Subject: [PATCH] Fix "Uncaught Error: Cannot access private property wishthis\User::$locale" --- src/pages/profile.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/pages/profile.php b/src/pages/profile.php index ceff887b..9e987511 100644 --- a/src/pages/profile.php +++ b/src/pages/profile.php @@ -32,12 +32,7 @@ if (isset($_POST['user-id'], $_POST['section'])) { 'column' => 'email', 'key' => 'user-email', 'label' => __('Email'), - ), - array( - 'column' => 'locale', - 'key' => 'user-locale', - 'label' => __('Language'), - ), + ) ); $loginRequired = false; @@ -92,6 +87,22 @@ if (isset($_POST['user-id'], $_POST['section'])) { /** * Preferences */ + /** Locale */ + if (isset($_POST['user-locale']) && $_POST['user-locale'] !== $_SESSION['user']->getLocale()) { + $_SESSION['user']->setLocale($_POST['user-locale']); + + $set[] = '`locale` = "' . $_SESSION['user']->getLocale() . '"'; + + $page->messages[] = Page::success( + sprintf( + __('Locale successfully updated!'), + 'Locale' + ), + __('Success') + ); + } + + /** Channel */ if (isset($_POST['user-channel']) && $_POST['user-channel'] !== $_SESSION['user']->channel) { if (empty($_POST['user-channel'])) { $_SESSION['user']->channel = null;