Skip to content

Commit

Permalink
After agreeing to site policy, you get redirected back to where you
Browse files Browse the repository at this point in the history
were going.

Also, guests get asked to agree for EVERY SESSION.
  • Loading branch information
moodler committed Nov 29, 2004
1 parent 561c0c4 commit 957b519
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ function require_login($courseid=0, $autologinguest=true) {
// Check that the user has agreed to a site policy if there is one
if (!empty($CFG->sitepolicy)) {
if (!$USER->policyagreed) {
$SESSION->wantsurl = $FULLME;
redirect($CFG->wwwroot .'/user/policy.php');
die;
}
Expand Down
15 changes: 12 additions & 3 deletions user/policy.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@
}

if ($agree == 1 and confirm_sesskey()) { // User has agreed
if (!set_field('user', 'policyagreed', 1, 'id', $USER->id)) {
error('Could not save your agreement');
if ($USER->username != 'guest') { // Don't remember guests
if (!set_field('user', 'policyagreed', 1, 'id', $USER->id)) {
error('Could not save your agreement');
}
}
$USER->policyagreed = 1;
redirect($CFG->wwwroot);

if (!empty($SESSION->wantsurl)) {
$wantsurl = $SESSION->wantsurl;
unset($SESSION->wantsurl);
redirect($wantsurl);
} else {
redirect($CFG->wwwroot.'/');
}
exit;
}

Expand Down

0 comments on commit 957b519

Please sign in to comment.