if (get_user_preferences('auth_forcepasswordchange') && !session_is_loggedinas()) {
$userauth = get_auth_plugin($USER->auth);
if ($userauth->can_change_password() and !$preventredirect) {
- $SESSION->wantsurl = $FULLME;
+ if ($setwantsurltome) {
+ $SESSION->wantsurl = $FULLME;
+ }
if ($changeurl = $userauth->change_password_url()) {
//use plugin custom url
redirect($changeurl);
if ($preventredirect) {
throw new require_login_exception('User not fully set-up');
}
- $SESSION->wantsurl = $FULLME;
+ if ($setwantsurltome) {
+ $SESSION->wantsurl = $FULLME;
+ }
redirect($CFG->wwwroot .'/user/edit.php?id='. $USER->id .'&course='. SITEID);
}
if ($preventredirect) {
throw new require_login_exception('Policy not agreed');
}
- $SESSION->wantsurl = $FULLME;
+ if ($setwantsurltome) {
+ $SESSION->wantsurl = $FULLME;
+ }
redirect($CFG->wwwroot .'/user/policy.php');
} else if (!empty($CFG->sitepolicyguest) and isguestuser()) {
if ($preventredirect) {
throw new require_login_exception('Policy not agreed');
}
- $SESSION->wantsurl = $FULLME;
+ if ($setwantsurltome) {
+ $SESSION->wantsurl = $FULLME;
+ }
redirect($CFG->wwwroot .'/user/policy.php');
}
}
if ($preventredirect) {
throw new require_login_exception('Not enrolled');
}
- $SESSION->wantsurl = $FULLME;
+ if ($setwantsurltome) {
+ $SESSION->wantsurl = $FULLME;
+ }
redirect($CFG->wwwroot .'/enrol/index.php?id='. $course->id);
}
}