MDL-59756 enrol: Swap positions of edit and unenrol actions
[moodle.git] / enrol / self / lib.php
index a1bfd9b..e612891 100644 (file)
@@ -534,18 +534,18 @@ class enrol_self_plugin extends enrol_plugin {
         $instance = $ue->enrolmentinstance;
         $params = $manager->get_moodlepage()->url->params();
         $params['ue'] = $ue->id;
-        if ($this->allow_unenrol($instance) && has_capability("enrol/self:unenrol", $context)) {
-            $url = new moodle_url('/enrol/unenroluser.php', $params);
-            $actionparams = array('class' => 'unenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_UNENROL);
-            $actions[] = new user_enrolment_action(new pix_icon('t/delete', get_string('unenrol', 'enrol')),
-                get_string('unenrol', 'enrol'), $url, $actionparams);
-        }
         if ($this->allow_manage($instance) && has_capability("enrol/self:manage", $context)) {
             $url = new moodle_url('/enrol/editenrolment.php', $params);
             $actionparams = array('class' => 'editenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_EDIT);
             $actions[] = new user_enrolment_action(new pix_icon('t/edit', get_string('editenrolment', 'enrol')),
                 get_string('editenrolment', 'enrol'), $url, $actionparams);
         }
+        if ($this->allow_unenrol($instance) && has_capability("enrol/self:unenrol", $context)) {
+            $url = new moodle_url('/enrol/unenroluser.php', $params);
+            $actionparams = array('class' => 'unenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_UNENROL);
+            $actions[] = new user_enrolment_action(new pix_icon('t/delete', get_string('unenrol', 'enrol')),
+                get_string('unenrol', 'enrol'), $url, $actionparams);
+        }
         return $actions;
     }