-
Bug
-
Resolution: Fixed
-
Major
-
2.2.7, 2.3.4, 2.4.1, 2.5
-
MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
-
MOODLE_23_STABLE, MOODLE_24_STABLE
-
wip-
MDL-37983-master -
Default home page 'user preference' has no effect on the first page displayed after logging in. The site home is always displayed regardless of which page a user has set as their default homepage.
MDL-32108 was supposed to fix this, but it hasn't.
This comment suggests the stanza be moved into the "else" clause above it. As a result, a fix that was working is now broken, and all users are sent to site home.
If $SESSION->wantsurl === $CFG->wwwroot . '/' you end up in the "elseif" clause:
} else if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0 or strpos($SESSION->wantsurl, str_replace('http://', 'https://', $CFG->wwwroot)) === 0)) {
|
$urltogo = $SESSION->wantsurl; /// Because it's an address in this site
|
unset($SESSION->wantsurl);
|
because strpos($SESSION->wantsurl, $CFG->wwwroot) === 0 in that case. Something earlier in the sequence is setting $SESSION->wantsurl, possibly require_login() in moodlelib.php because we force login at our site.
I think there are two possible fixes. Either detect the fact that $SESSION->wantsurl === $CFG->wwwroot . '/' in the "elseif" clause above, or move the whole homepage detecting code outside the if .. elseif .. else and place it in its own clause as below:
if ($urltogo === $CFG->wwwroot.'/') {
|
$home_page = get_home_page();
|
// Go to my-moodle page instead of site homepage if defaulthomepage set to homepage_my
|
if ($home_page == HOMEPAGE_MY && !is_siteadmin() && !isguestuser()) {
|
if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot.'/' or $urltogo == $CFG->wwwroot.'/index.php') {
|
$urltogo = $CFG->wwwroot.'/my/';
|
}
|
}
|
}
|
- is a regression caused by
-
MDL-32108 Default home page for users: "user preference" not behaving as expected
-
- Closed
-