diff --git a/my/indexsys.php b/my/indexsys.php index 70577d70d28..ac64d290d1b 100644 --- a/my/indexsys.php +++ b/my/indexsys.php @@ -60,10 +60,10 @@ $PAGE->set_title($header); $PAGE->set_heading($header); $PAGE->blocks->add_region('content'); -// TODO: Make the page be selected properly in the Settings block +admin_externalpage_setup('mypage'); // Get the My Moodle page info. Should always return something unless the database is broken. -if (!$currentpage = my_get_page(0, MY_PAGE_PRIVATE)) { +if (!$currentpage = my_get_page(null, MY_PAGE_PRIVATE)) { print_error('mymoodlesetup'); } $PAGE->set_subpage($currentpage->id); @@ -98,12 +98,6 @@ if ($PAGE->user_allowed_editing()) { $USER->editing = $edit = 0; } -// HACK WARNING! This loads up all this page's blocks in the system context -if ($currentpage->userid == 0) { - $CFG->blockmanagerclass = 'my_syspage_block_manager'; -} - - echo $OUTPUT->header(); echo $OUTPUT->blocks_for_region('content'); diff --git a/my/lib.php b/my/lib.php index 46183a60a2b..0c713a4bc5d 100644 --- a/my/lib.php +++ b/my/lib.php @@ -39,7 +39,7 @@ require_once("$CFG->libdir/blocklib.php"); function my_get_page($userid, $private=MY_PAGE_PRIVATE) { global $DB, $CFG; - if (empty($CFG->forcedefaultmymoodle)) { // We ignore custom My Moodle pages if admin has forced them + if (empty($CFG->forcedefaultmymoodle) && $userid) { // Ignore custom My Moodle pages if admin has forced them // Does the user have their own page defined? If so, return it. if ($customised = $DB->get_record('my_pages', array('userid' => $userid, 'private' => $private))) { return $customised; diff --git a/user/profilesys.php b/user/profilesys.php index 587d98968cd..d45f9073141 100644 --- a/user/profilesys.php +++ b/user/profilesys.php @@ -57,7 +57,7 @@ $PAGE->blocks->add_region('content'); // TODO: Make the page be selected properly in the Settings block // Get the Public Profile page info. Should always return something unless the database is broken. -if (!$currentpage = my_get_page(0, MY_PAGE_PUBLIC)) { +if (!$currentpage = my_get_page(null, MY_PAGE_PUBLIC)) { print_error('publicprofilesetup'); } $PAGE->set_subpage($currentpage->id); @@ -92,12 +92,6 @@ if ($PAGE->user_allowed_editing()) { $USER->editing = $edit = 0; } -// HACK WARNING! This loads up all this page's blocks in the system context -if ($currentpage->userid == 0) { - $CFG->blockmanagerclass = 'my_syspage_block_manager'; -} - - echo $OUTPUT->header(); echo $OUTPUT->blocks_for_region('content');