Commit 18b4f9e7 authored by Richard Mansfield's avatar Richard Mansfield

Revert "Rewrite blog link in menu when changing multipleblogs setting (bug #691548)"

This reverts commit d8e97612.
parent 09c7e038
......@@ -192,7 +192,7 @@ $prefsform = array(
'jsform' => true,
'plugintype' => 'core',
'pluginname' => 'account',
'jssuccesscallback' => 'accountPrefsSuccess',
'jssuccesscallback' => 'clearPasswords',
'elements' => $elements
);
......@@ -266,19 +266,14 @@ function accountprefs_submit(Pieform $form, $values) {
update_send_count($u,true);
}
$returndata = array();
if (isset($values['multipleblogs'])) {
if ((bool) $USER->get_account_preference('multipleblogs') !== (bool) $values['multipleblogs']) {
$returndata['multipleblogs'] = $values['multipleblogs'] ? 'on' : 'off'; // Rewrite the blogs link in the menu
}
}
foreach (array_keys($expectedprefs) as $pref) {
if (isset($values[$pref])) {
$USER->set_account_preference($pref, $values[$pref]);
}
}
$returndata = array();
if (isset($values['username']) && $values['username'] != $USER->get('username')) {
$USER->username = $values['username'];
$USER->commit();
......@@ -298,7 +293,7 @@ $smarty = smarty();
$smarty->assign('form', $prefsform);
$smarty->assign('candeleteself', $USER->can_delete_self());
$smarty->assign('INLINEJAVASCRIPT', "
function accountPrefsSuccess(form, data) {
function clearPasswords(form, data) {
formSuccess(form, data);
if ($('accountprefs_oldpassword')) {
$('accountprefs_oldpassword').value = '';
......@@ -309,14 +304,6 @@ function accountPrefsSuccess(form, data) {
var username = getFirstElementByTagAndClassName('a', null, 'profile-sideblock-username');
replaceChildNodes(username, data.username);
}
if (data.multipleblogs) {
var newhref = data.multipleblogs == 'on' ? 'artefact/blog/' : 'artefact/blog/view/';
forEach(getElementsByTagAndClassName('a', null, 'main-nav'), function (link) {
if (getNodeAttribute(link, 'href').match(new RegExp('/artefact/blog/'))) {
setNodeAttribute(link, 'href', config.wwwroot + newhref);
}
});
}
}
");
$smarty->assign('PAGEHEADING', TITLE);
......
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