Issue Details (XML | Word | Printable)

Key: MDL-6160
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Tim Hunt
Reporter: Imported
Votes: 15
Watchers: 6
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

email admin when course is requested

Created: 24/Jul/06 08:02 AM   Updated: 21/Jan/09 04:51 PM
Return to search
Component/s: Course
Affects Version/s: 1.6.1
Fix Version/s: 1.9.4

File Attachments: 1. Text File courserequestnotifications.patch.txt (6 kB)
2. File cron_course_pending.php (4 kB)

Environment: All

Participants: Bertold Altaner, Helen Foster, Howard Miller, Imported, James Barrett, Matt Campbell, Petr Skoda, Sven Laudel and Tim Hunt
Security Level: None
QA Assignee: Helen Foster
Resolved date: 14/Jan/09
Affected Branches: MOODLE_16_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
As the site admin, I would like to receive an email to notify me that a course has been requested so I know to look at the pending requests.



Ours is a small site, and I do not routinely go to the course creation page where I would see the message that a request was made.



The email does not need to include any details - a simple statement that a request has been made, so I know that I should deal with it.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Matt Campbell added a comment - 17/Jan/07 11:08 AM
This is the code I added to /admin/cron.php, just after the language cache is checked (so the course request check will be done every time the cron job is run). I've hard-coded the strings, so you might want to change it a bit and add it to a language file:

mtrace("Checking course creation requests");
if ($pending = get_records("course_request")) { $admin = get_admin(); $subject = "Course requests pending approval"; $messagetext = "Course requests have been submitted for approval. Please check pending.html."; email_to_user($admin,$admin,$subject,$messagetext); }
mtrace("Course requests checked");


Bertold Altaner added a comment - 27/Mar/08 05:07 PM
Hi,
i've attached a new cron_course_pending.php which is called by an new crontab-entry e.g. twice a day.
Possible crontab-entry:
//0 6,18 * * * root wget -O /var/log/moodle-cron-course-pending http://localhost/moodle/admin/cron-course-pending.php >/dev/null 2>&1 &

Notice: every time you call this skript admin will receive a email if pending courses are available - so think about your cron-intervall you will call this script...

Bertold


Petr Skoda added a comment - 27/Mar/08 05:18 PM
oh. forgot about this, sorry :-O
this should definitely be in 1.9.x

Sven Laudel added a comment - 08/May/08 05:16 PM
We did something similar, but not in cron.ph instead in course/request.php:

//Begin: Informing Admin
$moodleadmin = get_record('user','id',3);
$emailText = "Es liegt eine neue Kursanforderung von $USER->firstname $USER->lastname vor! \n\n Titel: $data->fullname \n Grund: $data->reason\n";
email_to_user($moodleadmin, $USER, 'Neue Kursanforderung', $emailText);
//End: Informing Admin

notice(get_string('courserequestsuccess'));

Thanks to Andre Krüger from Berlin who suggested this to me at moodle.de.


James Barrett added a comment - 10/Jul/08 08:19 PM
We did something similar to this in course_request.php

but used the form:

$admin = get_admin();
$subject = 'course request';
$messagetext = 'a course has been requested. Go to '.$CFG->wwwroot.'/course/pending.php to see it';
email_to_user($admin,$USER, $subject, $messagetext);

This way it is easy to reply to the requesting user and also link to /course/pending.php


Tim Hunt added a comment - 10/Dec/08 11:58 AM
Fixed, mostly thanks to Petr.

Helen Foster added a comment - 16/Dec/08 07:30 PM
Tim and Petr, thanks a lot for fixing this issue

It's now noted in the documentation:

http://docs.moodle.org/en/Course_request
http://docs.moodle.org/en/Moodle_1.9.4_release_notes


Helen Foster added a comment - 17/Dec/08 08:03 AM
Thinking a bit more about this feature, it seems weird to enter a username for the user to be notified when new course requested.

Why not instead have email notification sent to all admins or have a field for entering an email address to which notification should be sent?


Tim Hunt added a comment - 17/Dec/08 07:44 PM
Helen, is there a precedent in any of the other admin settings?

Helen Foster added a comment - 17/Dec/08 11:01 PM
Hi Tim,

In Administration > Security > Notifications the notifyloginfailures setting has 3 options - Nobody, Administrator and All administrators (I'm not sure how this is working since the implementation of roles!)

Alternatively, perhaps we could have a notifycourserequest capability similar to mod/quiz:emailnotifysubmission.


Tim Hunt added a comment - 06/Jan/09 03:18 PM
The attached patch (HEAD only) changes to admin setting to be a multi-select box with a list of all the users who have the 'moodle/site:approvecourse' capability, and lets you select any number of those users.

What do people think?

And should we do something similar for notify login failures?


Tim Hunt added a comment - 07/Jan/09 06:33 PM
We need to add a 'Nobody' option to the select box, for the benefit of the 99% of the world who do not know to use CTRL+click.

Helen Foster added a comment - 08/Jan/09 01:41 AM
I think the multi-select box for course notification is great! It's really clever that only relevant users are listed.

A Nobody option would be helpful for people like me who don't know about CTRL+click. Alternatively, the following text could be added to the lang string:

Multiple users may be selected/deselected by holding down the Apple or Ctrl key whilst clicking on the users' names.

+1 for a multi-select box for notifyloginfailures. I can't find any other admin settings which would benefit from the same treatment.


Tim Hunt added a comment - 08/Jan/09 04:07 PM
Right. fixed now. Please test.

Note, I only changed the notifyloginfailures setting in HEAD.


Howard Miller added a comment - 13/Jan/09 08:09 PM
I think there's a problem here... please see:

http://tracker.moodle.org/browse/MDL-17877


Tim Hunt added a comment - 14/Jan/09 01:12 PM
Actually, MDL-17877 is not caused by this. Re-resolving.

And I don't see the point of reopening this bug after you have filed a separate bug. (By all means link the bugs.)


Helen Foster added a comment - 21/Jan/09 04:44 PM
Tim, thanks a lot for further improving course request notifications. Everything seems to be working fine

Helen Foster added a comment - 21/Jan/09 04:51 PM
notifyloginfailures improvement noted in the documentation:

http://docs.moodle.org/en/Notifications