Fix "Uncaught Error: Cannot access private property wishthis\User::$locale"

This commit is contained in:
grandeljay 2022-09-22 10:58:43 +02:00
parent 583f2b0763
commit c86865bc61

View file

@ -32,12 +32,7 @@ if (isset($_POST['user-id'], $_POST['section'])) {
'column' => 'email', 'column' => 'email',
'key' => 'user-email', 'key' => 'user-email',
'label' => __('Email'), 'label' => __('Email'),
), )
array(
'column' => 'locale',
'key' => 'user-locale',
'label' => __('Language'),
),
); );
$loginRequired = false; $loginRequired = false;
@ -92,6 +87,22 @@ if (isset($_POST['user-id'], $_POST['section'])) {
/** /**
* Preferences * 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!'),
'<strong>Locale</strong>'
),
__('Success')
);
}
/** Channel */
if (isset($_POST['user-channel']) && $_POST['user-channel'] !== $_SESSION['user']->channel) { if (isset($_POST['user-channel']) && $_POST['user-channel'] !== $_SESSION['user']->channel) {
if (empty($_POST['user-channel'])) { if (empty($_POST['user-channel'])) {
$_SESSION['user']->channel = null; $_SESSION['user']->channel = null;