MDL-8765 user preference usage cleanup

This commit is contained in:
skodak 2007-03-06 10:45:49 +00:00
parent 06565ec739
commit f2d042c4c3
6 changed files with 15 additions and 19 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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;

View File

@ -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();

View File

@ -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);
}
}

View File

@ -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);