MDL-49981 badges: Missing link to manage your badges
authorFrederic Massart <fred@moodle.com>
Fri, 24 Apr 2015 04:55:22 +0000 (12:55 +0800)
committerDan Poltawski <dan@moodle.com>
Tue, 28 Apr 2015 09:13:36 +0000 (10:13 +0100)
lang/en/badges.php
lib/navigationlib.php

index 82850a2..bcb43aa 100644 (file)
@@ -284,6 +284,7 @@ $string['localbadgesp'] = 'Badges from {$a}:';
 $string['makeprivate'] = 'Make private';
 $string['makepublic'] = 'Make public';
 $string['managebadges'] = 'Manage badges';
+$string['managemybadges'] = 'Manage my badges';
 $string['message'] = 'Message body';
 $string['messagebody'] = '<p>You have been awarded the badge "%badgename%"!</p>
 <p>More information about this badge can be found at %badgelink%.</p>
index 0afffc1..f0163cd 100644 (file)
@@ -2251,12 +2251,6 @@ class global_navigation extends navigation_node {
                 $usernode->add(get_string('myfiles'), $url, self::TYPE_SETTING);
             }
 
-            if (!empty($CFG->enablebadges) && $iscurrentuser &&
-                    has_capability('moodle/badges:manageownbadges', $usercontext)) {
-                $url = new moodle_url('/badges/mybadges.php');
-                $usernode->add(get_string('mybadges', 'badges'), $url, self::TYPE_SETTING);
-            }
-
             // Add a node to view the users notes if permitted.
             if (!empty($CFG->enablenotes) &&
                     has_any_capability(array('moodle/notes:manage', 'moodle/notes:view'), $coursecontext)) {
@@ -4283,12 +4277,6 @@ class settings_navigation extends navigation_node {
                 $dashboard->add(get_string('myfiles'), $url, self::TYPE_SETTING);
             }
 
-            if (!empty($CFG->enablebadges) && $iscurrentuser &&
-                    has_capability('moodle/badges:manageownbadges', $usercontext)) {
-                $url = new moodle_url('/badges/mybadges.php');
-                $dashboard->add(get_string('mybadges', 'badges'), $url, self::TYPE_SETTING);
-            }
-
             // Add a node to view the users notes if permitted.
             if (!empty($CFG->enablenotes) &&
                     has_any_capability(array('moodle/notes:manage', 'moodle/notes:view'), $coursecontext)) {
@@ -4500,6 +4488,10 @@ class settings_navigation extends navigation_node {
         // Badges.
         if ($currentuser && !empty($CFG->enablebadges)) {
             $badges = $usersetting->add(get_string('badges'), null, navigation_node::TYPE_CONTAINER, null, 'badges');
+            if (has_capability('moodle/badges:manageownbadges', $usercontext)) {
+                $url = new moodle_url('/badges/mybadges.php');
+                $badges->add(get_string('managemybadges', 'badges'), $url, self::TYPE_SETTING);
+            }
             $badges->add(get_string('preferences', 'badges'), new moodle_url('/badges/preferences.php'),
                     navigation_node::TYPE_SETTING);
             if (!empty($CFG->badges_allowexternalbackpack)) {