MDL-49845 profile: changed 'My preferences' display logic

This commit is contained in:
Dave Cooper 2015-04-28 14:02:49 +08:00
parent c1f97c777f
commit 7193ea2cd2
3 changed files with 5 additions and 3 deletions

View File

@ -23,3 +23,4 @@ mypreferences,core_grades
myprofile,core
myprofilemyblogs,core_blog
viewallmyentries,core_blog
userspreferences,core_moodle

View File

@ -1934,7 +1934,6 @@ $string['usernameoremail'] = 'Enter either username or email address';
$string['usernotconfirmed'] = 'Could not confirm {$a}';
$string['userpic'] = 'User picture';
$string['users'] = 'Users';
$string['userspreferences'] = 'User {$a}\'s preferences';
$string['userselectorautoselectunique'] = 'If only one user matches the search, select them automatically';
$string['userselectorpreserveselected'] = 'Keep selected users, even if they no longer match the search';
$string['userselectorsearchanywhere'] = 'Match the search text anywhere in the displayed fields';
@ -2042,3 +2041,5 @@ $string['yourself'] = 'yourself';
$string['yourteacher'] = 'your {$a}';
$string['yourwordforx'] = 'Your word for \'{$a}\'';
$string['zippingbackup'] = 'Zipping backup';
// Deprecated since Moodle 2.9
$string['userspreferences'] = 'User {$a}\'s preferences';

View File

@ -100,9 +100,9 @@ function core_myprofile_navigation(core_user\output\myprofile\tree $tree, $user,
}
// Preference page. Only visible by administrators.
if (is_siteadmin()) {
if (!$iscurrentuser && is_siteadmin()) {
$url = new moodle_url('/user/preferences.php', array('userid' => $user->id));
$title = $iscurrentuser ? get_string('preferences') : get_string('userspreferences', 'moodle', fullname($user));
$title = get_string('preferences', 'moodle');
$node = new core_user\output\myprofile\node('administration', 'preferences', $title, null, $url);
$tree->add_node($node);
}