Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.6.4, 1.9, 2.0.2
-
Fix Version/s: DEV backlog
-
Component/s: Database activity module
-
Affected Branches:MOODLE_16_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
Description
To be consistent with other modules (similar to the assignment module) and to help teachers be aware of when a database entry needs to be approved, it would be helpful to have an option to Email Notify Teacher(s) when a new database entry is added. Ideally, I would like to see this included in 1.8 because I believe that it is the type of notification behavior that teachers have come to expect from Moodle.
Attachments
-
- data_notify.patch
- 08/Aug/09 5:03 AM
- 7 kB
- Anthony Borrow
-
$i18n.getText("admin.common.words.hide")
- DBmailnotify.zip
- 07/Aug/08 5:30 AM
- 8 kB
- Edward Hewlett
-
- mod_form.php 4 kB
- comment.php 8 kB
- edit.php 17 kB
- readme.TXT 0.3 kB
-
- Email notification settings in mod_form.bmml
- 25/Mar/10 5:23 AM
- 2 kB
- David Mudrak
-
- Email notification settings in mod_form.bmml
- 25/Mar/10 3:06 AM
- 2 kB
- David Mudrak
-
- MDL-8377.patch
- 25/Dec/09 11:54 PM
- 7 kB
- Anthony Borrow
-
- moodle19_moddata_notification.patch
- 21/Aug/07 3:41 PM
- 9 kB
- Ashley Holman
-
- notification-20100617.patch
- 18/Jun/10 4:40 AM
- 10 kB
- Nate Baxley
-
- Email notification settings in mod_form.png
- 40 kB
- 25/Mar/10 5:23 AM
Issue Links
Activity
- All
- Comments
- History
- Activity
- Source
- Test Sessions
Note that this would require a new field in the database.
Note also that we can't say "teachers" because of roles which are totally customizable.
So I would recommend some setting like "send notifications" with an integer field like "notification" along with some capabilities like:
mod/data:notifyadd
mod/data:notifyapproved (to original author and anyone else with the cap)
that various roles could have turned on/off via role definition or overrides.
The integer should probably be a bitmask, then you could turn on/off these notifications with several checkboxes.
I've just added the "notification" field to 1.9 now because we are about to go into a freeze, so you can work against that.
if you work on this, please attach a patch for review before any changes in CVS.
Excellent! Would what Martin is proposing also make it possible to set the database to send a notification to teacher/original author if a comment is added to an item in the database?
Here is a patch to add email notifications upon submission of new/updated database entries. I've added a 'yes/no' option to the database module for enabling this feature.
When a submission is added/updated, users on the course capable of rating that submission (having the mod/data:rate capability) are alerted with an email linking them to the submission. I have based it on the email notifications from the assignment module, so have re-used some code from that and formatted the emails in the same way for consistency.
Note: this patch contains a new file which needs to be added to the repository - lang/en_utf8/help/data/notification.html
Thanks
Ashley.
Ashley - Somewhat related to this issue of email notification but something that I've not had a chance to test is the default behavior for database entries (either in Moodle 1.8 or 1.9 or both). such that if a user modifies the entry that it must be re-approved by the instructor before being visible to other course participants?
Just had a quick look at this code ...
1) There is no error handling/checking of returned results from calls like $courseobj = get_record('course', 'id', $data->course);
2) all new functions in data/lib.php should start with data_
3) there are no new capabilities .. it's currently emailing all people who can rate entries whenever any entry is added. Is this what we want? I think we might need a little more control for different scenarios.
Thanks for looking at this. I will add error checking and rename those functions (I wasn't sure whether the data_ prefix was just used for functions that get called externally). I implemented the email notifications in the same way that they are done in the assignment module, as in anyone who can rate/grade the entry will receive the notification, and like the assignment module there is an option to have notifications on/off for an individual instance of the module. If you think adding a new capability is needed then I will work on including that too.
Thanks
Ashley.
I think there's an important difference between the assignment and database modules i.e. grading and rating, are they getting mixed up here?
Ray, do you have a suggestion on how this should be implemented then?
Sadly not (non-developer here), but it looks like it's new code rather than grabbing something that already exists. I think linking to ratings could be inappropriate if students(for example) are given the rating capability.
Is there anything that can be extended from the glossary approval code?
Since there is no finished solution to this I'm bumping it to after 1.9
Has there been any progress on implementing this features? Will we actually see this functionality in Moodle 1.9.1? Our school has been waiting eagerly for something like this and was hoping it would be in Moodle 1.9, as it would significantly improve the usefulness of the database module to have copies of comments e-mailed out to the teacher and/or the individual who created the entry that is being commented on!
As this is such an important issue to the organization I work for, I have managed to persuade my employers to pay for an implementation of this feature. Ideally, if the feature is useful and well-implemented, I would like to see our customization contributed to the Moodle core. Can anyone interested in this issue tell me how to go about doing that?
The way I am proposing this feature will work (to the developer we are hiring to do this) is as follows:
1) When an item is added to the database, the teacher(s) of the course in which the database exists will be notified by e-mail, in a manner similar to the way that teachers can choose to be notified of assignment submissions.
2) When a comment is added to an item in the database...
2a) ...by a teacher, the creator of that item will be notified - ideally, the text of the comment will be mailed out along with the notification.
2b) ...by anyone other than a teacher, the teacher will be notified - ideally, with the text of the comment as well.
3) Two options would be added to the database creation/update page, allowing the database creator/editor to turn on notifications (a) on data add and (b) when a comment is added.
Does that sound like a reasonable structure? Or, if this is already almost implemented, should our project be called off?
Edward - I've not looked at the patch, so I don't know how much of the work is done. Your ideas seem pretty good. My only question is dealing with comments which I think is really a separate type of notification. I like on creation notifying the teacher, with comments I think regardless of who makes the comments that it may be helpful for the creator to receive a copy. I'm not as convinced that the teacher getting a copy of every comment is all that helpful but do think it should be an option. So I think we would have several options for
Teacher notification:
Notify on Creation (1)
Notify on Update (2)
Notify on Comments (4)
Student notification:
Notify on All Comments (8)
Notify only Teacher Comments (16)
Since we have a field for notification I would suggest storing an integer there that gets interpreted to extrapolate which of this binary switches is active. So having none of those set would produce a notification value of 0 (00000) and having all of them set would produce a value of 31 (11111). I think this would give you what you are looking for and allows for some further tweaking and adding of additional options if needed. Does that make sense?
Also, thanks for your generosity in helping to promote this forward by seeking out a developer and being willing to share that code with the rest of the community. Once we have some code, I would be happy to create some space in CONTRIB where we could create a patch. Then it could be evaluated by the other developers and be considered for inclusion into core. If you have any questions on how to contribute code you may want to first take a look at: http://docs.moodle.org/en/Development:Guidelines_for_contributed_code
Don't hesitate to let me know if there is anything I can do to be supportive.
Peace - Anthony
What I am really missing is an option to get notified per mail when somebody adds a comments to the same record after I have added a comment. So I know when someone may have replied to a question I have asked. A good example on how important would such a feature are the database activities used on moodle.org: The communication simply does not work. On some records within the add-ons database, months will go by before the author has a change to recognize that someone has asked something.
Robert - My fear with what you describe is that the comments move from being comments to a discussion thread and then it will mushroom into being a mini-forum module. At the very least, I think to implement what you are describing we would have to keep track of which users and "subscribed" to use forum language to the comments or database. Being subscribed would mean that you will be sent emails depending on how the database activity is setup (i.e. using the options I referenced above). If that were setup then you could add to what I had by having:
Subscription notification:
Notify on Update (32)
Notify on Teacher Comments (64)
Notify on All Comments (128)
But I do think it would be important for an individual user to opt-in or be able to opt-out of receiving those notifications and I suppose that then for consistency purposes in creating the database, the teacher should have the option of forcing subscriptions. Now for tracking the subscriptions would one be subscribed to the database activity or for the particular record? I suspect you would want the particular record.
Peace - Anthony
Anthony,
yes, being subscribed to the comments of a particular record is what I am missing. Please take a short look at - for example http://moodle.org/mod/data/view.php?d=13&mode=single&page=238 to understand why this would really be important. You will see the record where the author of the "Quickmail 2" block offers his contribution. Users use the comments to report problems and ask questions. I think if the author knows that someone has been asking him something via these comments, he would reply. But the only way to be aware of that is to periodically call that page, than scroll down some kilometers
and look if there is a reply. Sometimes nobody replies for months and you get frustrated to do repeat that procedure so often for nothing. As a result, the communication process breaks.
However, it seems that being subscribed to a particular database record comments system requires additional SQL fields, so we won't see such a feature before Moodle 2.0.
Best regards,
Robert
I agree that there is a risk that a forum variant is created. This wouldn't be good IMO. An option for a simple notification that a comment has been added is fine though e.g. as in assignments.
Ray,
imagine a database activity with thousands of records, where you are interested in only one specific one. Do you really want to get emails each time someone comments one of the thousands of records you are not interested in??
No. That's why it would need to be an option for each Database instance.
Please rethink: The same database instance can contain these thousands of records, that's why I'm trying to explain that a database-wise option is not enough.
Here is the customization (DBmailnotify.zip - attached) that my organization commissioned to enable e-mail notification on addition of any item or comment to the database. It's implemented pretty simply - there's an option that is added to the database creation/update page that turns e-mail notifications on or off - and the customization alerts course teachers to any DB items or comments added by students - and alerts contributors when a comment is added to one of the items they have contributed.
Hope it proves helpful.
Just to report on our customization... Our organization has found it very helpful - it makes the database module a useful tool for teacher/student communication. Any chance that the code we've provided may prove useful and that this might actually make it into 1.9.5?
Edward - Any chance of getting a patch file instead of the zip file. I would try to create one but I suspect that if it was developed against 1.9.2 there have been other changes as well so I could not create a clean patch file of just your changes. See http://docs.moodle.org/en/Development:How_to_create_a_patch if you need help and if there are questions let me know. Peace - Anthony
I am going to be testing Edward's code and having a look at it since I have a client that also wants that functionality. Peace - Anthony
I believe this is a patch of the changes proposed by Edward. I will use this as a starting point and begin working on adding the capabilities that MD mentioned earlier and creating some language strings to make this a more thorough patch. Peace - Anthony
Yes, the Aug 8 patch file does indeed look like it was derived from the customization we commissioned - though I don't know who produced it. (I have no knowledge of how to go about doing it, myself!) Any sense on whether or not this capability might actually make it into 1.9.7, as projected? I would dearly love to see this taken up as a core feature!
I have also tweaked the above code slightly (and VERY roughly) so that notification is also sent out to the student if his/her entry is edited. I'm sure anyone here can do a much better job of programming this extra notification than I did, but I could upload my rough edit if anyone wanted me to.
Edward - No matter how rough, anything you have implemented can certainly be shared and then folks can improve upon it as they see fit. I too think that having this in Moodle ASAP is a good idea as it facilitates the communication between teachers and students making the database activity module a more effective tool. Peace - Anthony
Edward - It looks like I was the one to produce the diff based on the zip file that you uploaded. It is still on my backlog of issues to play with as I wanted to add the capabilities as MD suggested previously in this issue. Peace - Anthony
>sigh< I've been waiting for this feature to make it into core since 2007 and Moodle 1.8 - now it's been bumped again. Will it ever get in?
Edward - I understand your sigh. I too sometimes feel that when I see an issue I was hoping would get resolved bumped to yet another later release. For me, it is MDL-8555 which is slightly after this one but has enjoyed a similar history. Hopefully once I finish with classes this semester (in mid-December) I will have time to finish off a patch. I think the database activity module needs a bit of TLC and this would be one of those issues to make it more consistent with the behavior of other modules. An alternative perspective is that this time has allowed you the opportunity to do extensive testing of the patch
It may take a while, but it is worth the wait. For now, the developers are focused on Moodle 2.0. Peace - Anthony
Ashley - Are you still planning on working on this or should we re-assign it back to Moodle.com? Peace - Anthony
Sorry, assigning back to moodle.com. I developed this patch in 2007 which is posted here. If its not acceptable I won't be able to do any more on it (already finished that project).
Regards
Ashley
Thanks Ashley for re-assigning back to moodle.com. I have taken a look at your patch will be working on cleaning a few things up. In addition to the capabilities which Martin mentioned previously, I would like to create a data_email_user function in /mod/data/lib.php to reduce duplication of some of the code. I think I will try to expand on the notification options as I mentioned previously. Also there seemed to be some unnecessary code which I will try to clean up. Thanks for your initial work on this.
Revisiting the subscription issue, I do not see that as being part of my efforts with this tracker issue. Instead I would like to stick with things that do not require each user to specify their setting but rather settings for how notifications (I am even wondering if these should be messages instead of emails) are to be handled. So a database would have notification settings to either email teacher of course and/or the record adder of any changes to the record. Similarly, the database would have notification options for adding comments such that the teacher of the course or record adder receive a copy. I would probably avoid sending notifications to all persons who have commented on a database entry but in theory would entertain the idea.
Before I go too far, are there any objections to changing this from emailing a user to sending the user a message (i.e. notification). Keep in mind that Moodle messages can be set up such that they are emailed to the user but this is controlled by the user. I believe that this is more in line with how things are being designed for Moodle 2.0.
Peace - Anthony
Here is an updated patch file for Moodle 1.9 that hopefully removes what I believe were unnecessary lookups and variables. I still want to implement better nuanced notifications to allow more precise control and to address MD's previously mentioned concerns but this is at least a start. Peace - Anthony
Changing to messaging is counter intuitive imo. The expectation will be that this works like assignment submission alerts.
Ray - Good point, I think I was thinking more ideally rather than practically. I'll try to move forward on a patch that emails like the assignment activity module. Peace - Anthony
I am going to implement this and commit it right after we release 1.9.8. We have code freeze right now so there is no way to get it in sooner, sorry. Some thoughts:
- no support for "notify teacher" or "notify student" - everything gonna be controlled via the combination of the settings in the mockup and capabilities. Teachers and Students have been legacy concepts, we have just roles these days
- no support for per-record subscription in 1.9 and 2.0. This can be added for 2.1 - a new table is needed and we have no time to do this for 2.0 now, sorry.
- no support for "notify teacher" or "notify student" - everything gonna be controlled via the combination of the settings in the mockup and capabilities. Teachers and Students have been legacy concepts, we have just roles these days
- no support for per-record subscription in 1.9 and 2.0. This can be added for 2.1 - a new table is needed and we have no time to do this for 2.0 now, sorry.
+ 1 for "Teacher can..." , "Student can..." however I think here (and elsewhere) it would be good to find a way to be more granular about which roles can do these special things from the activity set up without compromising the logic of who has access to overrides.
Nonetheless, this looks good. Thanks David.
btw, should the references be to "entry" rather than "record" to be consistent with the "Add entry" references. And for the last one I would say this should be "the author on commenting on the record (entry)".
Edited UI Mockup <Email notification settings in mod_form>: Fixed wording - thanks Ray
Anthony,
I started using your patch from 12/25/2009 and noticed that the new field you added to the form is called notification. It looks like there was already a field called notification that was used to trigger rater notices. It showed up when I noticed I couldn't set "Email notifications" to No and "Send notifications to teachers/students" to Yes. It also ends up sending duplicate emails when new entry is added. One for the course teacher, and one to each of the raters (which in my case was all 3 people assigned the teacher role). I think we need to rename one of these fields.
I'd also suggest that new entry notices should go to all users assigned the teacher role instead of just the "first" one as there's no way to control which one that is with the get_teacher function.
Maybe I'm not working with the latest version, but that was the most up-to-date patch I saw listed here.
Nate - It has been a while since I looked at this issue. Would you be able to create a revised patch with your suggested improvements. Ultimately, anything that I added was simply to assist David. Rather than trying to take a look at it (since I am so far behind on contrib related stuff) I will defer to David. Thanks for reporting your concerns with the patch. From what I can tell, this is still an open issue so it has not been committed to core. Peace - Anthony
All,
I realized after looking closer that I had applied patches from two different solutions and that was what caused the problem. However, I also noticed that Anthony's earlier patch used the get_teacher function which is deprecated and which only returns one user from the teacher group, even when there are more. I made some changes to send notices to all those in the teacher role except when the one posting the update is a teacher. I think this is a little better, but I'm open to arguments why not.
Nate
Nate - Yep, that sounds good to me Nate. It is better to not use get_teacher. I'm not sure if I was just being lazy when I did that or not thinking. Peace - Anthony
Anthony,
I'm sure it just slipped through while you were doing 200 other things. ![]()
- Nate
- Nate
Thank you, Nate! It's been a while since I visited this issue, and I somehow missed your improvement of the code my organization originally submitted. It wasn't Anthony, in fact, who used the deprecated get_teacher function, it was our programmer (though it was done so long ago, I'm not sure if that function had been deprecated yet when the code was originally written) who wrote the code that Anthony kindly made into a proper patch.
We had, in fact, been suffering from the limitation of the use of the get_teacher function for quite a while, but your fix, Nate, which I have just applied, has resolved the notification-of-only-one-teacher problem. Thanks so much!
Now if only this functionality will finally manage to find its way into core...
Thanks everyone for your votes and comments on this issue. David, please could we have an update of where we're at.
I've applied notification-20100617.patch (18/Jun/10 4:40 AM) to 1.9.11 (Build: 20110221), and it works great with one caveat: commenters on an entry are not notified of replies. This essentially forces commenters to keep checking back to see if anyone has replied to their comment or if there are any new comments. I would like to see emails pushed out to commenters so as to keep the conversation alive. Perhaps two settings: (1) commenters receive emails from author replies only; (2) commenters receive emails from all subsequent comments.
IMO that doesn't really matter. This isn't a blog or a forum. My vote is not to extend to this level.
Ray, I'm confused. Are you are in support of teachers and authors being informed by email of entries and comments, yet not in support of commenters enjoying the same functionality? If I could ask, why not extend the functionality to all participants?
I think it's reasonable to assume that commenters will ask questions. They should be informed by email of subsequent comments.
Steven - I'm not sure how Ray would respond but I do remember thinking at one point that we have to be careful with comments that it does not attempt to morph itself into a mini-forum module. In Moodle 2.0 comment (http://docs.moodle.org/en/Comments_2.0), the interface is deliberately simple. So I think the risk for "feature bloat" is real. Since the idea here was simply to provide a notification to teachers when data was created so that the teacher would know there was a new entry to approve. This notification allows the teacher to stay on top of newly created data. It may be best to maintain focus on that for the sake of this issue. I would like to see some thought given to how modules notify teachers and creators of content throughout Moodle for 2.1. Notification for comments is worth considering as well but perhaps as a separate issue (not sure if it already exists). Peace - Anthony
Anthony, thank you for the explanation. I can appreciate the original intent of this tracker item, but why not take it one logical step further? There are myriad scenarios in which teachers and students would appreciate a stronger social/interactive element to database entries, and email notifications is one way to enable that. (Adding database entries and comments to the Recent Activity block is another.) The compartmentalization of functionality (database is for database; forum is for forum) is not the future, IMHO.
Steven - Thanks for continuing to advocate for and envisioning how the database activity module can better serve the needs of the community. I have found that providing real use scenarios demonstrating how a feature can be helpful to give some momentum to feature requests/improvements. So I think the approach of one practical step at a time without loosing sight of larger goals is important. I believe the primary goal of the Moodle 2.1 Roadmap (http://docs.moodle.org/en/Roadmap#Version_2.1) is to improve all of the activity modules and focus on how they are actually used. Your ideas about how those can provide a strong social/interactive element could be useful in those discussions. I believe the changes to messaging and thinking about notification more broadly (in 2.0) and a similar abstraction of comments (to make them more consistent among all modules (in 2.0) lay a foundation for your ideas. I would encourage you to continue discussion either in the talk section of the Moodle Docs or perhaps for a broader audience in the General Developers forum. As there is greater clarity, we can then work up specs for the work and create a separate tracker issue for it. Peace - Anthony
I am a newbie - but really want this feature of notification via email in DATABASE (our course is almost wholly made up of database activities) - can anybody here guide me how to apply this patch for 2.0.2
In a test installation of moodle i copied the files from DBmailnotify.zip into the /mod/data directory.
When i goto an pre-existing database activity and do a add entry - i get this error
get_record() not available anymore
However i am able to add a comment to the entries made earlier (to patch application)
Pl guide me how to set this up correctly and start gettign email notifications
I could really use the functionality of emailing teachers when students create a new database item for a 18 course curriculum we are developing. Any chance that this patch will be incorporated into core Moodle 2 anytime soon?
Bump. What's the current status of implementing this proposed improvement?
In keeping with the aim of this option, it would also be helpful if there was a corresponding option to turn on e-mail notifications to be mailed out to database entry creators if the teacher edits or comments on the database entry they have created.