Commit 5e07db54 authored by Richard Mansfield's avatar Richard Mansfield

Remove confusing message when disabling multiple journals (bug #918571)

When you have multiple journals allowed in your account settings and
then delete all journals and want to switch back to a single journal,
the error message "You cannot disable multiple journals unless you
only have one journal" still comes up though no journal exists.

This message is confusing, it's simpler to hide the option altogether
for users with no journals.

Change-Id: I397422d4ad043c86621180837a16e1440b1243cd
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent f15d037c
......@@ -92,6 +92,9 @@ $elements['accountoptionsdesc'] = array(
// Add general account options
$elements = array_merge($elements, general_account_prefs_form_elements($prefs));
// If the user doesn't have exactly one blog, don't show the multipleblogs option.
$elements['multipleblogs']['ignore'] = count_records('artefact', 'artefacttype', 'blog', 'owner', $USER->get('id')) != 1;
$elements['submit'] = array(
'type' => 'submit',
'value' => get_string('save')
......@@ -143,13 +146,6 @@ function accountprefs_validate(Pieform $form, $values) {
$form->set_error('username', get_string('usernamealreadytaken', 'auth.internal'));
}
}
// Don't let users turn multiple blogs off unless they only have 1 blog
if ($USER->get_account_preference('multipleblogs')
&& empty($values['multipleblogs'])
&& count_records('artefact', 'artefacttype', 'blog', 'owner', $USER->get('id')) != 1) {
$form->set_error('multipleblogs', get_string('disablemultipleblogserror', 'account'));
}
}
function accountprefs_submit(Pieform $form, $values) {
......
......@@ -64,7 +64,6 @@ $string['tagssideblockmaxtagsdescription'] = 'Maximum number of tags to display
$string['enablemultipleblogs'] = 'Enable multiple journals';
$string['enablemultipleblogsdescription'] = 'By default, you have one journal. If you would like to keep more than one journal, check this option.';
$string['disablemultipleblogserror'] = 'You cannot disable multiple journals unless you only have one journal';
$string['hiderealname'] = 'Hide real name';
$string['hiderealnamedescription'] = 'Check this box if you have set a display name and you do not want other users to be able to find you by your real name in user searches.';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment