mirror of
https://github.com/moodle/moodle.git
synced 2025-01-30 03:58:34 +01:00
MDL-8765 user preference usage cleanup
This commit is contained in:
parent
06565ec739
commit
f2d042c4c3
@ -36,8 +36,8 @@ class block_admin_bookmarks extends block_base {
|
||||
|
||||
$this->content = new stdClass;
|
||||
$this->content->text = '';
|
||||
if (isset($USER->preference['admin_bookmarks'])) {
|
||||
$bookmarks = explode(',',$USER->preference['admin_bookmarks']);
|
||||
if (get_user_preferences('admin_bookmarks')) {
|
||||
$bookmarks = explode(',',get_user_preferences('admin_bookmarks'));
|
||||
// hmm... just a liiitle (potentially) processor-intensive
|
||||
// (recall that $adminroot->locate is a huge recursive call... and we're calling it repeatedly here
|
||||
|
||||
|
@ -8,8 +8,8 @@ require_login();
|
||||
|
||||
if ($section = optional_param('section', '', PARAM_ALPHAEXT) and confirm_sesskey()) {
|
||||
|
||||
if (isset($USER->preference['admin_bookmarks'])) {
|
||||
$bookmarks = explode(',',$USER->preference['admin_bookmarks']);
|
||||
if (get_user_preferences('admin_bookmarks')) {
|
||||
$bookmarks = explode(',',get_user_preferences('admin_bookmarks'));
|
||||
|
||||
if (in_array($section, $bookmarks)) {
|
||||
error(get_string('bookmarkalreadyexists','admin'));
|
||||
@ -39,11 +39,11 @@ if ($section = optional_param('section', '', PARAM_ALPHAEXT) and confirm_sesskey
|
||||
|
||||
if (is_a($temp, 'admin_settingpage')) {
|
||||
|
||||
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section, get_string('bookmarkadded','admin'), 1);
|
||||
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section);
|
||||
|
||||
} elseif (is_a($temp, 'admin_externalpage')) {
|
||||
|
||||
redirect($temp->url, get_string('bookmarkadded','admin'), 1);
|
||||
redirect($temp->url);
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,9 +8,9 @@ require_login();
|
||||
|
||||
if ($section = optional_param('section', '', PARAM_ALPHAEXT) and confirm_sesskey()) {
|
||||
|
||||
if (isset($USER->preference['admin_bookmarks'])) {
|
||||
if (get_user_preferences('admin_bookmarks')) {
|
||||
|
||||
$bookmarks = explode(',', $USER->preference['admin_bookmarks']);
|
||||
$bookmarks = explode(',', get_user_preferences('admin_bookmarks'));
|
||||
|
||||
$key = array_search($section, $bookmarks);
|
||||
|
||||
@ -28,9 +28,9 @@ if ($section = optional_param('section', '', PARAM_ALPHAEXT) and confirm_sesskey
|
||||
if (is_a($temp, 'admin_externalpage')) {
|
||||
redirect($temp->url, get_string('bookmarkdeleted','admin'));
|
||||
} elseif (is_a($temp, 'admin_settingpage')) {
|
||||
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section, get_string('bookmarkdeleted','admin'), 1);
|
||||
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section);
|
||||
} else {
|
||||
redirect($CFG->wwwroot, get_string('bookmarkdeleted', 'admin'),1);
|
||||
redirect($CFG->wwwroot);
|
||||
}
|
||||
die;
|
||||
|
||||
|
@ -110,7 +110,7 @@
|
||||
|
||||
|
||||
print_header($strchangepassword, $strchangepassword, $navstr);
|
||||
if (!empty($USER->preference['auth_forcepasswordchange'])) {
|
||||
if (get_user_preferences('auth_forcepasswordchange')) {
|
||||
notify(get_string('forcepasswordchangenotice'));
|
||||
}
|
||||
$mform->display();
|
||||
|
@ -45,10 +45,10 @@ class login_change_password_form extends moodleform {
|
||||
$mform->setType('id', PARAM_INT);
|
||||
|
||||
// buttons
|
||||
if (empty($USER->preference['auth_forcepasswordchange'])) {
|
||||
$this->add_action_buttons(true);
|
||||
} else {
|
||||
if (get_user_preferences('auth_forcepasswordchange')) {
|
||||
$this->add_action_buttons(false);
|
||||
} else {
|
||||
$this->add_action_buttons(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,11 +98,7 @@
|
||||
unset($SESSION->fromdiscussion);
|
||||
|
||||
if ($mode) {
|
||||
if (isguest()) {
|
||||
$USER->preference['forum_displaymode'] = $mode; // don't save it in database
|
||||
} else {
|
||||
set_user_preference('forum_displaymode', $mode);
|
||||
}
|
||||
set_user_preference('forum_displaymode', $mode);
|
||||
}
|
||||
|
||||
$displaymode = get_user_preferences('forum_displaymode', $CFG->forum_displaymode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user