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
Michael Blake made changes - 21/Aug/06 05:01 PM
Field Original Value New Value
Assignee Petr Skoda [ petrskoda ] Petr ?koda [ skodak ]
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


Bertold Altaner made changes - 27/Mar/08 05:08 PM
Attachment cron_course_pending.php [ 13457 ]
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

Petr Skoda made changes - 27/Mar/08 05:18 PM
Fix Version/s 1.9.1 [ 10240 ]
Petr Skoda made changes - 17/Apr/08 05:52 AM
Status In Progress [ 3 ] Open [ 1 ]
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.


Martin Dougiamas made changes - 15/May/08 03:02 PM
Fix Version/s 1.9.2 [ 10280 ]
Fix Version/s 1.9.1 [ 10240 ]
Petr Skoda made changes - 06/Jul/08 12:29 AM
Fix Version/s 1.9.3 [ 10290 ]
Fix Version/s 1.9.2 [ 10280 ]
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


Martin Dougiamas made changes - 15/Oct/08 03:00 PM
Fix Version/s 1.9.3 [ 10290 ]
Fix Version/s 1.9.4 [ 10300 ]
Tim Hunt made changes - 01/Dec/08 05:56 PM
Assignee Petr ?koda [ skodak ] Tim Hunt [ timhunt ]
tjhunt committed 8 files to 'Moodle CVS' - 10/Dec/08 11:57 AM
course request: MDL-17575 and MDL-6160 further improvements:

1/ email notification when course requested
2/ course request capability so that we can limit who can request new course
3/ list of my pending course requests on the request form

Implemented in 1.9 by Petr Skoda, and reviewed and merged to HEAD by me.
MODIFY lang/en_utf8/role.php   Rev. 1.85    (+2 -1 lines)
MODIFY version.php   Rev. 1.915    (+1 -1 lines)
MODIFY lib/db/access.php   Rev. 1.98    (+9 -1 lines)
MODIFY course/lib.php   Rev. 1.629    (+2 -2 lines)
MODIFY admin/settings/courses.php   Rev. 1.29    (+2 -1 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.245    (+4 -0 lines)
MODIFY course/request.php   Rev. 1.20    (+30 -2 lines)
MODIFY course/request_form.php   Rev. 1.17    (+13 -1 lines)
tjhunt committed 8 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 10/Dec/08 11:57 AM
course request: MDL-17575 and MDL-6160 further improvements:

1/ email notification when course requested
2/ course request capability so that we can limit who can request new course
3/ list of my pending course requests on the request form

Implemented in 1.9 by Petr Skoda, and reviewed and merged to HEAD by me.
MODIFY admin/settings/courses.php   Rev. 1.14.2.7    (+2 -1 lines)
MODIFY lang/en_utf8/role.php   Rev. 1.47.2.18    (+2 -1 lines)
MODIFY lib/db/access.php   Rev. 1.75.2.17    (+9 -1 lines)
MODIFY course/request.php   Rev. 1.14.2.2    (+20 -2 lines)
MODIFY course/lib.php   Rev. 1.538.2.64    (+2 -2 lines)
MODIFY version.php   Rev. 1.563.2.340    (+1 -1 lines)
MODIFY course/request_form.php   Rev. 1.11.2.4    (+13 -1 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.154.2.68    (+4 -0 lines)
Tim Hunt added a comment - 10/Dec/08 11:58 AM
Fixed, mostly thanks to Petr.

Tim Hunt made changes - 10/Dec/08 11:58 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
martignoni committed 2 files to 'Lang CVS' - 10/Dec/08 06:27 PM
New strings translated for MDL-17575 and MDL-6160
MODIFY fr_utf8/admin.php   Rev. 1.322    (+4 -1 lines)
MODIFY fr_utf8/role.php   Rev. 1.106    (+2 -1 lines)
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?


Helen Foster made changes - 17/Dec/08 08:03 AM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
QA Assignee tsala
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 made changes - 06/Jan/09 03:18 PM
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.


tjhunt committed 5 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 08/Jan/09 04:05 PM
course requests: MDL-6160 clean up admin option for choosing who is notified.
MODIFY admin/settings/courses.php   Rev. 1.14.2.9    (+2 -2 lines)
MODIFY lib/adminlib.php   Rev. 1.153.2.58    (+68 -2 lines)
MODIFY course/request.php   Rev. 1.14.2.3    (+3 -2 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.154.2.76    (+2 -0 lines)
MODIFY lib/moodlelib.php   Rev. 1.960.2.111    (+20 -1 lines)
tjhunt committed 8 files to 'Moodle CVS' - 08/Jan/09 04:07 PM
course requests: MDL-6160 clean up admin option for choosing who is notified. Merged from MOODLE_19_STABLE.

Also, change the 'notifyloginfailures' setting to use the same sort of admin setting type.
MODIFY admin/settings/security.php   Rev. 1.32    (+2 -4 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.255    (+2 -0 lines)
MODIFY lib/db/upgrade.php   Rev. 1.261    (+15 -1 lines)
MODIFY lib/adminlib.php   Rev. 1.296    (+68 -2 lines)
MODIFY course/request.php   Rev. 1.21    (+3 -3 lines)
MODIFY version.php   Rev. 1.951    (+1 -1 lines)
MODIFY lib/moodlelib.php   Rev. 1.1147    (+20 -9 lines)
MODIFY admin/settings/courses.php   Rev. 1.31    (+2 -2 lines)
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.


Tim Hunt made changes - 08/Jan/09 04:07 PM
Status Reopened [ 4 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
martignoni committed 1 file to 'Lang CVS' - 11/Jan/09 06:10 PM
MDL-6160 new strings
MODIFY fr_utf8/admin.php   Rev. 1.334    (+3 -1 lines)
Mitsuhiro Yoshida committed 3 files to 'Lang CVS' - 12/Jan/09 03:42 PM
MDL-6160 Translated new strings for admin.
MDL-17853 Translated a new string for error messages.
MODIFY ja_utf8/README   Rev. 1.914    (+1 -1 lines)
MODIFY ja_utf8/admin.php   Rev. 1.332    (+3 -1 lines)
MODIFY ja_utf8/error.php   Rev. 1.115    (+2 -2 lines)
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


Howard Miller made changes - 13/Jan/09 08:09 PM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
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.)


Tim Hunt made changes - 14/Jan/09 01:12 PM
Status Reopened [ 4 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
tjhunt committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 16/Jan/09 05:34 PM
adminlib: MDL-6160 mess up my lovely code just to keep PHP4 happy.

Thanks to Ashley Holman for noticing my mistake.
MODIFY lib/adminlib.php   Rev. 1.153.2.62    (+3 -3 lines)
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 made changes - 21/Jan/09 04:44 PM
Status Resolved [ 5 ] Closed [ 6 ]
Helen Foster added a comment - 21/Jan/09 04:51 PM
notifyloginfailures improvement noted in the documentation:

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