Commit 47a4b2c4 authored by Richard Mansfield's avatar Richard Mansfield

Stop users from turning off multiple blogs unless they have one blog

Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent f5b4f099
......@@ -230,6 +230,13 @@ 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) {
......
......@@ -62,6 +62,7 @@ $string['tagssideblockmaxtagsdescription'] = 'Maximum number of tags to display
$string['enablemultipleblogs'] = 'Enable multiple blogs';
$string['enablemultipleblogsdescription'] = 'By default, Mahara gives you one blog. If you would like to keep more than one blog, check this option.';
$string['disablemultipleblogserror'] = 'You cannot disable multiple blogs unless you only have one blog';
$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