Skip to content

Commit

Permalink
Fix language_ui pref
Browse files Browse the repository at this point in the history
  • Loading branch information
makss committed Nov 14, 2017
1 parent 1cd1960 commit aa446fd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions textpattern/include/txp_lang.php
Expand Up @@ -264,7 +264,7 @@ function save_language_ui()

if ($locale) {
$msg = gTxt('preferences_saved');
set_pref('language_ui', $language_ui, 'admin', PREF_CORE, 'text_input', 0, PREF_PRIVATE);
set_pref('language_ui', $language_ui);
$textarray = load_lang($language_ui);
} else {
$msg = array(gTxt('locale_not_available_for_language', array('{name}' => $langName)), E_WARNING);
Expand Down Expand Up @@ -390,7 +390,7 @@ function remove_language()
$site_lang = get_pref('language', TEXTPATTERN_DEFAULT_LANG, true);
$ui_lang = get_pref('language_ui', $site_lang, true);
$ui_lang = (array_key_exists($ui_lang, $represented_lang)) ? $ui_lang : $site_lang;
set_pref('language_ui', $ui_lang, 'admin', PREF_CORE, 'text_input', 0, PREF_PRIVATE);
set_pref('language_ui', $ui_lang);
$textarray = load_lang($ui_lang);
} else {
$msg = gTxt('cannot_delete', array('{thing}' => $langName));
Expand Down
1 change: 1 addition & 0 deletions textpattern/vendors/Textpattern/DB/Core.php
Expand Up @@ -166,6 +166,7 @@ public function getPrefsDefault()
$pf['blog_mail_uid'] = empty($_SESSION['email']) ? md5(rand()).'blog@gmail.com' : $_SESSION['email'];
$pf['blog_uid'] = empty($blog_uid) ? md5(uniqid(rand(), true)) : $blog_uid;
$pf['language'] = $language;
$pf['language_ui'] = $language;
$pf['locale'] = getlocale($language);
$pf['sitename'] = gTxt('my_site');
$pf['site_slogan'] = gTxt('my_slogan');
Expand Down
10 changes: 9 additions & 1 deletion textpattern/vendors/Textpattern/DB/Data/core.prefs
Expand Up @@ -444,7 +444,7 @@
"val": "",
"type": "2",
"event": "publish",
"html": "languages",
"html": "text_input",
"position": "0"
},
"lastmod": {
Expand Down Expand Up @@ -657,6 +657,14 @@
"html": "yesnoradio",
"position": "240"
},
"language_ui": {
"val": "",
"type": "2",
"event": "admin",
"html": "text_input",
"position": "0",
"private": "1"
},
"default_publish_status": {
"val": "4",
"type": "0",
Expand Down

1 comment on commit aa446fd

@Bloke
Copy link
Member

@Bloke Bloke commented on aa446fd Nov 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@makss This seems to have broken per-user admin languages. If I use two independent users and switch one of them to a different language, both their UIs change to the same language. Any idea why this isn't working with pref_private?

Please sign in to comment.