Skip to content

Commit

Permalink
MDL-70173 core: Use a meaningful first level header
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies committed Feb 9, 2021
1 parent 1ac3fb7 commit cebee49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/outputrenderers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4142,6 +4142,8 @@ public function context_header($headerinfo = null, $headinglevel = 1) {
// Make sure to use the heading if it has been set.
if (isset($headerinfo['heading'])) {
$heading = $headerinfo['heading'];
} else {
$heading = $this->page->heading;
}

// The user context currently has images and buttons. Other contexts may follow.
Expand All @@ -4166,7 +4168,7 @@ public function context_header($headerinfo = null, $headinglevel = 1) {

if (user_can_view_profile($user, $course)) {
// Use the user's full name if the heading isn't set.
if (!isset($heading)) {
if (empty($heading)) {
$heading = fullname($user);
}

Expand Down
5 changes: 3 additions & 2 deletions my/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@
$USER->editing = $edit = 0; // Just in case
$context = context_system::instance();
$PAGE->set_blocks_editing_capability('moodle/my:configsyspages'); // unlikely :)
$header = "$SITE->shortname: $strmymoodle (GUEST)";
$strguest = get_string('guest');
$header = "$SITE->shortname: $strmymoodle ($strguest)";
$pagetitle = $header;

} else { // We are trying to view or edit our own My Moodle page
$userid = $USER->id; // Owner of the page
$context = context_user::instance($USER->id);
$PAGE->set_blocks_editing_capability('moodle/my:manageblocks');
$header = fullname($USER);
$header = "$SITE->shortname: $strmymoodle";
$pagetitle = $strmymoodle;
}

Expand Down

0 comments on commit cebee49

Please sign in to comment.