Commit a1708181 authored by andyjdavis's avatar andyjdavis
Browse files

course MDL-25831 made course request notifications work

parent c63ebd43
......@@ -4074,8 +4074,7 @@ class course_request {
*/
protected function notify($touser, $fromuser, $name='courserequested', $subject, $message) {
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->component = 'course';
$eventdata->component = 'moodle';
$eventdata->name = $name;
$eventdata->userfrom = $fromuser;
$eventdata->userto = $touser;
......@@ -4084,6 +4083,7 @@ class course_request {
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
$eventdata->notification = 1;
message_send($eventdata);
}
}
......@@ -40,7 +40,10 @@ if (isguestuser()) {
if (empty($CFG->enablecourserequests)) {
print_error('courserequestdisabled', '', $returnurl);
}
require_capability('moodle/course:request', get_context_instance(CONTEXT_SYSTEM));
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/course:request', $context);
$PAGE->set_context($context);
/// Set up the form.
$data = course_request::prepare();
......@@ -67,4 +70,4 @@ echo $OUTPUT->header();
echo $OUTPUT->heading($strtitle);
// Show the request form.
$requestform->display();
echo $OUTPUT->footer();
\ No newline at end of file
echo $OUTPUT->footer();
......@@ -986,6 +986,9 @@ $string['messagebody'] = 'Message body';
$string['messagedselectedusers'] = 'Selected users have been messaged and the recipient list has been reset.';
$string['messagedselectedusersfailed'] = 'Something went wrong while messaging selected users. Some may have received the email.';
$string['messageprovider:backup'] = 'Backup notifications';
$string['messageprovider:courserequestapproved'] = 'Course creation request approval notification';
$string['messageprovider:courserequested'] = 'Course creation request notification';
$string['messageprovider:courserequestrejected'] = 'Course creation request rejection notification';
$string['messageprovider:errors'] = 'Important errors with the site';
$string['messageprovider:errors_help'] = 'These are important errors that an administrator should know about.';
$string['messageprovider:notices'] = 'Notices about minor problems';
......
......@@ -43,6 +43,21 @@ $messageproviders = array (
'backup' => array (
'capability' => 'moodle/site:config'
),
//course creation request notification
'courserequested' => array (
'capability' => 'moodle/site:approvecourse'
),
//course request approval notification
'courserequestapproved' => array (
'capability' => 'moodle/course:request'
),
//course request rejection notification
'courserequestrejected' => array (
'capability' => 'moodle/course:request'
)
);
......@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2010122900; // YYYYMMDD = date of the last version bump
$version = 2011010400; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0.1+ (Build: 20101229)'; // Human-friendly version name
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment