# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/auth/email/auth.php
--- moodle/auth/email/auth.php Base (1.29)
+++ moodle/auth/email/auth.php Locally Modified (Based On 1.29)
@@ -217,6 +217,14 @@
         return isset($CFG->recaptchapublickey) && isset($CFG->recaptchaprivatekey) && get_config("auth/{$this->authtype}", 'recaptcha');
     }
 
+    /**
+     * Enrolled users can be manually deleted without any worries.
+     *
+     * @return true
+     */
+    function allow_manual_user_deletion() {
+        return true;
 }
+}
 
 
Index: moodle/auth/manual/auth.php
--- moodle/auth/manual/auth.php Base (1.16)
+++ moodle/auth/manual/auth.php Locally Modified (Based On 1.16)
@@ -178,6 +178,12 @@
         }
     }
 
+    /**
+     * Manually enrolled users can be manually deleted without any worries.
+     *
+     * @return true
+     */
+    function allow_manual_user_deletion() {
+        return true;
 }
-
-
+}
\ No newline at end of file
Index: moodle/auth/none/auth.php
--- moodle/auth/none/auth.php Base (1.14)
+++ moodle/auth/none/auth.php Locally Modified (Based On 1.14)
@@ -123,6 +123,14 @@
         return true;
     }
 
+    /**
+     * Enrolled users can be manually deleted without any worries.
+     *
+     * @return true
+     */
+    function allow_manual_user_deletion() {
+        return true;
 }
+}
 
 
Index: moodle/lib/authlib.php
--- moodle/lib/authlib.php Base (1.34)
+++ moodle/lib/authlib.php Locally Modified (Based On 1.34)
@@ -494,4 +494,15 @@
         return array();
     }
 
+    /**
+     * Returns true if users can be manually deleted.
+     *
+     * This should be overridden to return true if the auth plugin is OK with
+     * users being manually deleted.
+     *
+     * @return bool False by default.
+     */
+    function allow_manual_user_deletion() {
+        return false;
 }
+}
Index: moodle/lib/navigationlib.php
--- moodle/lib/navigationlib.php Base (1.204)
+++ moodle/lib/navigationlib.php Locally Modified (Based On 1.204)
@@ -3331,7 +3331,7 @@
             return true;
         }
 
-        // Add the profile edit link
+        // Add the profile edit and delete links
         if (isloggedin() && !isguestuser($user) && !is_mnet_remote_user($user)) {
             if (($currentuser || is_siteadmin($USER) || !is_siteadmin($user)) && has_capability('moodle/user:update', $systemcontext)) {
                 $url = new moodle_url('/user/editadvanced.php', array('id'=>$user->id, 'course'=>$course->id));
@@ -3350,9 +3350,10 @@
             }
         }
 
-        // Change password link
         if (!empty($user->auth)) {
             $userauth = get_auth_plugin($user->auth);
+            
+            // Change password link
             if ($currentuser && !session_is_loggedinas() && $userauth->can_change_password() && !isguestuser() && has_capability('moodle/user:changeownpassword', $systemcontext)) {
                 $passwordchangeurl = $userauth->change_password_url();
                 if (empty($passwordchangeurl)) {
@@ -3360,7 +3361,13 @@
                 }
                 $usersetting->add(get_string("changepassword"), $passwordchangeurl, self::TYPE_SETTING);
             }
+
+            // Check if the user is deletable.
+            if (!$currentuser && !is_siteadmin($user) && $userauth->allow_manual_user_deletion() && has_capability('moodle/user:delete', $systemcontext)) {
+                $url = new moodle_url('/admin/user.php', array('delete'=>$user->id, 'sesskey'=>sesskey()));
+                $usersetting->add(get_string('deleteuser','admin'), $url, self::TYPE_SETTING);
         }
+        }
 
         // View the roles settings
         if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride','moodle/role:override', 'moodle/role:manage'), $usercontext)) {
