Skip to content

Commit

Permalink
MDL-48934 navigation: Update the default entries in the user menu.
Browse files Browse the repository at this point in the history
Add mypreferences and remove mybadges and myfiles (You should get to the
last 2 through your dashboard).

Part of MDL-45774
  • Loading branch information
Damyon Wiese authored and abgreeve committed Apr 10, 2015
1 parent 19b2179 commit e4522f8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
3 changes: 1 addition & 2 deletions admin/settings/appearance.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
new lang_string('configcustomusermenuitems', 'admin'),
'mygrades,grades|/grade/report/mygrades.php|grades
messages,message|/message/index.php|message
myfiles,moodle|/user/files.php|download
mybadges,badges|/badges/mybadges.php|award',
mypreferences,moodle|/user/preferences.php|preferences',
PARAM_TEXT,
'50',
'10'
Expand Down
1 change: 1 addition & 0 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,7 @@
$string['myhome'] = 'Dashboard';
$string['mymoodledashboard'] = 'My Moodle dashboard';
$string['myprofile'] = 'My profile';
$string['mypreferences'] = 'My preferences';
$string['name'] = 'Name';
$string['nameforlink'] = 'What do you want to call this link?';
$string['nameforpage'] = 'Name';
Expand Down
29 changes: 27 additions & 2 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4306,11 +4306,36 @@ function xmldb_main_upgrade($oldversion) {

if ($oldversion < 2015040800.01) {
// Add "My grades" to the user menu.
$newconfig = "mygrades,grades|/grade/report/mygrades.php|grades\n" . $CFG->customusermenuitems;
set_config('customusermenuitems', $newconfig);
$oldconfig = get_config('core', 'customusermenuitems');
if (strpos("mygrades,grades|/grade/report/mygrades.php|grades", $oldconfig) === false) {
$newconfig = "mygrades,grades|/grade/report/mygrades.php|grades\n" . $CFG->customusermenuitems;
set_config('customusermenuitems', $newconfig);
}

upgrade_main_savepoint(true, 2015040800.01);
}

if ($oldversion < 2015030400.02) {
// Update the default user menu (add preferences, remove my files and my badges).
$oldconfig = get_config('core', 'customusermenuitems');

// Add "My preferences" at the end.
if (strpos($oldconfig, "mypreferences,moodle|/user/preference.php|preferences") === false) {
$newconfig = $oldconfig . "\nmypreferences,moodle|/user/preferences.php|preferences";
} else {
$newconfig = $oldconfig;
}
// Remove my files.
$newconfig = str_replace("myfiles,moodle|/user/files.php|download", "", $newconfig);
// Remove my badges.
$newconfig = str_replace("mybadges,badges|/badges/mybadges.php|award", "", $newconfig);
// Remove holes.
$newconfig = preg_replace('/\n+/', "\n", $newconfig);
$newconfig = preg_replace('/(\r\n)+/', "\n", $newconfig);
set_config('customusermenuitems', $newconfig);

upgrade_main_savepoint(true, 2015030400.02);
}

return true;
}
Binary file added pix/t/preferences.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions pix/t/preferences.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e4522f8

Please sign in to comment.