mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-73233 my: Disable /my page depending on setting
When $CFG->enabledashboard will be disabled, the /my page will redirect to a different page or display an error message.
This commit is contained in:
parent
c612f121a0
commit
31ed9a6c2f
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
$string['coursemanagementoptions'] = 'Course management options';
|
||||
$string['error:dashboardisdisabled'] = 'The dashboard has been disabled by the administrator.';
|
||||
$string['mymoodle'] = 'Dashboard';
|
||||
$string['nocourses'] = 'No course information to show.';
|
||||
$string['noguest'] = 'The Dashboard page is not available to guest users';
|
||||
|
12
my/index.php
12
my/index.php
@ -52,6 +52,18 @@ if ($hassiteconfig && moodle_needs_upgrading()) {
|
||||
|
||||
$strmymoodle = get_string('myhome');
|
||||
|
||||
if (empty($CFG->enabledashboard)) {
|
||||
// Dashboard is disabled, so the /my page shouldn't be displayed.
|
||||
$defaultpage = get_default_home_page();
|
||||
if ($defaultpage == HOMEPAGE_MYCOURSES) {
|
||||
// If default page is set to "My courses", redirect to it.
|
||||
redirect(new moodle_url('/my/courses.php'));
|
||||
} else {
|
||||
// Otherwise, raise an exception to inform the dashboard is disabled.
|
||||
throw new moodle_exception('error:dashboardisdisabled', 'my');
|
||||
}
|
||||
}
|
||||
|
||||
if (isguestuser()) { // Force them to see system default, no editing allowed
|
||||
// If guests are not allowed my moodle, send them to front page.
|
||||
if (empty($CFG->allowguestmymoodle)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user