Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4913 #4914

Merged
merged 3 commits into from Aug 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions Sources/Themes.php
Expand Up @@ -600,12 +600,7 @@ function SetThemeOptions()
continue;

// Is this disabled?
if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled']))
{
unset($context['options'][$i]);
continue;
}
elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage']))
if (isset($setting['enabled']) && $setting['enabled'] === false)
{
unset($context['options'][$i]);
continue;
Expand Down
22 changes: 2 additions & 20 deletions Themes/default/Profile.template.php
Expand Up @@ -1742,29 +1742,11 @@ function template_profile_theme_settings()
}

// Is this disabled?
if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled']))
continue;

elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage']))
continue;

elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored']))
continue;

elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist']))
continue;

elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg']))
continue;

elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
continue;

elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
if (isset($setting['enabled']) && $setting['enabled'] === false)
continue;

// Some of these may not be set... Set to defaults here
$opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod');
$opts = array('calendar_start_day', 'topics_per_page', 'messages_per_page', 'display_quick_mod');
if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']]))
$context['member']['options'][$setting['id']] = 0;

Expand Down
9 changes: 8 additions & 1 deletion Themes/default/Settings.template.php
Expand Up @@ -15,7 +15,7 @@
*/
function template_options()
{
global $context, $txt;
global $context, $txt, $modSettings;

$context['theme_options'] = array(
$txt['theme_opt_calendar'],
Expand All @@ -28,6 +28,7 @@ function template_options()
6 => $txt['days'][6],
),
'default' => true,
'enabled' => !empty($modSettings['cal_enabled']),
),
$txt['theme_opt_display'],
array(
Expand All @@ -46,6 +47,7 @@ function template_options()
50 => 50,
),
'default' => true,
'enabled' => empty($modSettings['disableCustomPerPage']),
),
array(
'id' => 'messages_per_page',
Expand All @@ -58,6 +60,7 @@ function template_options()
50 => 50,
),
'default' => true,
'enabled' => empty($modSettings['disableCustomPerPage']),
),
array(
'id' => 'view_newest_first',
Expand All @@ -78,6 +81,7 @@ function template_options()
'id' => 'posts_apply_ignore_list',
'label' => $txt['posts_apply_ignore_list'],
'default' => false,
'enabled' => !empty($modSettings['enable_buddylist'])
),
$txt['theme_opt_posting'],
array(
Expand All @@ -94,6 +98,7 @@ function template_options()
'id' => 'wysiwyg_default',
'label' => $txt['wysiwyg_default'],
'default' => false,
'enabled' => empty($modSettings['disable_wysiwyg']),
),
array(
'id' => 'use_editor_quick_reply',
Expand All @@ -104,11 +109,13 @@ function template_options()
'id' => 'drafts_autosave_enabled',
'label' => $txt['drafts_autosave_enabled'],
'default' => true,
'enabled' => !empty($modSettings['drafts_autosave_enabled']) && (!empty($modSettings['drafts_post_enabled']) || !empty($modSettings['drafts_pm_enabled'])),
),
array(
'id' => 'drafts_show_saved_enabled',
'label' => $txt['drafts_show_saved_enabled'],
'default' => true,
'enabled' => !empty($modSettings['drafts_show_saved_enabled']) && (!empty($modSettings['drafts_post_enabled']) || !empty($modSettings['drafts_pm_enabled'])),
),
$txt['theme_opt_moderation'],
array(
Expand Down