$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
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'));
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);
}
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);
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;
print_header($strchangepassword, $strchangepassword, $navstr);
- if (!empty($USER->preference['auth_forcepasswordchange'])) {
+ if (get_user_preferences('auth_forcepasswordchange')) {
notify(get_string('forcepasswordchangenotice'));
}
$mform->display();
$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);
}
}
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);