MDL-59756 enrol: Swap positions of edit and unenrol actions
[moodle.git] / enrol / lti / lib.php
index 3e6cb2e..6f5ac9e 100644 (file)
@@ -390,18 +390,18 @@ class enrol_lti_plugin extends enrol_plugin {
         $instance = $ue->enrolmentinstance;
         $params = $manager->get_moodlepage()->url->params();
         $params['ue'] = $ue->id;
+        if ($this->allow_manage($instance) && has_capability("enrol/lti: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_user($instance, $ue) && has_capability("enrol/lti: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/lti: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, $actionparam);
-        }
         return $actions;
     }