Fix error when awarding a badge from recipients page
authorYuliya Bozhko <yuliya.bozhko@totaralms.com>
Tue, 9 Apr 2013 23:00:08 +0000 (11:00 +1200)
committerYuliya Bozhko <yuliya.bozhko@totaralms.com>
Tue, 9 Apr 2013 23:00:08 +0000 (11:00 +1200)
badges/award.php
badges/renderer.php

index b388e36..ae4b30e 100644 (file)
@@ -93,7 +93,8 @@ if ($isadmin) {
     }
 } else {
     // Current user's role.
-    $issuerrole = array_shift(get_user_roles($context, $USER->id));
+    $roles = get_user_roles($context, $USER->id);
+    $issuerrole = array_shift($roles);
     if (!isset($issuerrole->roleid) || !in_array($issuerrole->roleid, $accepted_roles)) {
         echo $OUTPUT->header();
         $rlink = html_writer::link(new moodle_url('recipients.php', array('id' => $badge->id)), get_string('recipients', 'badges'));
index 6c7dc92..a724bc1 100644 (file)
@@ -97,7 +97,7 @@ class core_badges_renderer extends plugin_renderer_base {
         $output = '';
         $formattributes = array();
         $formattributes['id'] = 'recipientform';
-        $formattributes['action'] = '';
+        $formattributes['action'] = $this->page->url;
         $formattributes['method'] = 'post';
         $output .= html_writer::start_tag('form', $formattributes);
         $output .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));