updated 2018-06-20
How to re-exclude admin, administrators, from the my-moodle dashboard. The moodle Administrator is no longer excluded from the my-moodle module.
Starting with moodle 2.0, if we activate the my-moodle {dashboard in mdl 3} front page for students, administrators get thrown into it also upon logging in and it, awkwardly, becomes the admin home page.
Throughout the moodle 1.x versions, you could turn on “MyMoodle” for users and there was an exception for administrators, that exception has been “lost” in moodle 2.0.x onward.
To fix, reinstate it, edit the primary index.php {moodle}/index.php :
moodle 2.x
down around line 70, find
} else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY)
&& optional_param('redirect', 1, PARAM_BOOL) === 1 ) {
redirect($CFG->wwwroot .'/my/');
and insert 2 carriage returns (to break it up)
and insert "&& !$hassiteconfig"
because the site configuration authority is only for admen. and this excludes them.
} else if (!empty($CFG->defaulthomepage)
&& ($CFG->defaulthomepage == HOMEPAGE_MY)
&& optional_param('redirect', 1, PARAM_BOOL) === 1
&& !$hassiteconfig ) {
redirect($CFG->wwwroot .'/my/');
note that you are inserting your new && clause right before the last 2 characters, the closing parenthesis and the opening bracket.
moodle 3.x
down around line 71, find
} else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY)
&& $redirect === 1 ) {
and insert 2 carriage returns (to break it up)
and insert "&& !$hassiteconfig"
because the site configuration authority is only for admen. and this excludes them.
} else if (!empty($CFG->defaulthomepage)
&& ($CFG->defaulthomepage == HOMEPAGE_MY)
&& $redirect === 1
&& !$hassiteconfig ) {
redirect($CFG->wwwroot .'/my/');
Again, the site configuration authority is only for admen. and this excludes them.