mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-74216 navigation: Do not show 'My courses' in primary nav to guests
This commit is contained in:
parent
9344149aba
commit
7066c7618c
@ -45,23 +45,21 @@ class primary extends view {
|
||||
$sitehome = $this->add(get_string('home'), new \moodle_url('/'), self::TYPE_SYSTEM,
|
||||
null, 'home', new \pix_icon('i/home', ''));
|
||||
}
|
||||
if (isloggedin() ) {
|
||||
if (!isguestuser()) {
|
||||
$homepage = get_home_page();
|
||||
if ($homepage == HOMEPAGE_MY || $homepage == HOMEPAGE_MYCOURSES) {
|
||||
// We need to stop automatic redirection.
|
||||
if ($showhomenode) {
|
||||
$sitehome->action->param('redirect', '0');
|
||||
}
|
||||
if (isloggedin() && !isguestuser()) {
|
||||
$homepage = get_home_page();
|
||||
if ($homepage == HOMEPAGE_MY || $homepage == HOMEPAGE_MYCOURSES) {
|
||||
// We need to stop automatic redirection.
|
||||
if ($showhomenode) {
|
||||
$sitehome->action->param('redirect', '0');
|
||||
}
|
||||
}
|
||||
|
||||
// Add the dashboard link.
|
||||
$showmyhomenode = empty($this->page->theme->removedprimarynavitems) ||
|
||||
!in_array('myhome', $this->page->theme->removedprimarynavitems);
|
||||
if ($showmyhomenode) {
|
||||
$this->add(get_string('myhome'), new \moodle_url('/my/'),
|
||||
self::TYPE_SETTING, null, 'myhome', new \pix_icon('i/dashboard', ''));
|
||||
}
|
||||
// Add the dashboard link.
|
||||
$showmyhomenode = empty($this->page->theme->removedprimarynavitems) ||
|
||||
!in_array('myhome', $this->page->theme->removedprimarynavitems);
|
||||
if ($showmyhomenode) {
|
||||
$this->add(get_string('myhome'), new \moodle_url('/my/'),
|
||||
self::TYPE_SETTING, null, 'myhome', new \pix_icon('i/dashboard', ''));
|
||||
}
|
||||
|
||||
// Add the mycourses link.
|
||||
|
@ -61,7 +61,7 @@ class primary_test extends \advanced_testcase {
|
||||
*/
|
||||
public function test_setting_initialise_provider() {
|
||||
return [
|
||||
'Testing as a guest user' => ['guest', ['home', 'courses']],
|
||||
'Testing as a guest user' => ['guest', ['home']],
|
||||
'Testing as an admin' => ['admin', ['home', 'myhome', 'courses', 'siteadminnode']],
|
||||
'Testing as a regular user' => ['user', ['home', 'myhome', 'courses']]
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user