Automatic email notification of a quiz on completion

Automatic email notification of a quiz on completion

by Just H -
Number of replies: 50
Hi all

The reason I got started with Moodle was due to a requirement to set up an online skills maintenance module for 400 or so people from various organisations outside my own to renew a photo ID pass.

One of the things my team and I had to do was find a way to be automatically notified when a person had passed or failed. If passed, his or her photo and details had to be emailed to a certain person to enable the new photo ID to be produced, if the person failed another person had to be notified so he could get in touch and discuss how to move forward.

To that end, we wrote a simple script that worked well for us (and a couple of other Moodlers are now using it I believe smile).

Now that the 400 or so have renewed their passe (roughly half did it online), we thought we'd try and incorporate it into the quiz setup so that it would be functionality available to any quiz (initially our site only had that one specific quiz and the script was written specifically for it). Although my team includes Flash developers we have had no prior experience with PHP or MySQL so it has been . . . fun!

We are now at the stage where we would like the community to test it and provide some feedback. Gustav in particular as, IMHO, I believe it would make a nice addition to the core module.

The screen shot in the next post shows how it looks. The attached file contains the relevant files and a step-by-step guide (readme.pdf) which includes a few things we still need to do. It has only been tested on 1.5.3+ so no doubt we'll have to tweak it for 1.6, people with a 1.6 install willing to test it much appreciated. At the moment the "pass" mark is 100% (we intend adding the ability to determine a pass mark during the quiz setup if a pass mark is in fact required for a given quiz) as a workaround at the moment if you just want an email notification to be sent no matter what the person scores use the "Fail" input.

I'm sure there will be other things that come out of your feedback. I'd appreciate it if you could take the time to have a play and let me know what you think and any bugs you find (solutions along with bug reports gratefully accepted big grin).

NOTE: as mentioned, we have no prior experience with PHP or MySQL so the usual caveats apply - a test server rather than a production server would be good and we take no responsibility if it causes the whole of the internet to go into meltdown! tongueout

Regards
H




Average of ratings: Useful (1)
In reply to Just H

Automatic email notification of a quiz on completion - screenshot

by Just H -
>
Attachment quiz_notification.jpg
In reply to Just H

Re: Automatic email notification of a quiz on completion - screenshot

by Kyle Claypool -
This looks like a great addition, I can't wait to give it a try. I do have a couple questions though, which I'll pose at the risk of sounding like a complete novice. The install file says to create a cron job at the end to run this file periodically. How do I create something like this that would run every half hour?

And my second question - if I wanted to set the "Pass" mark to something other than 100%, say 7/10 or 70%, is there any way I can do that? My PHP experience is limited and I didn't see anything that clearly allowed the setting of that option.

Thanks again for the great work.
In reply to Kyle Claypool

Re: Automatic email notification of a quiz on completion - screenshot

by Just H -
Hi Kyle

Sorry for the delay in getting back to you, only just noticed your post (sadly the "real world" is interrupting my play with Moodle!).

* Cron question - the answer to this would depend on your setup really, have a look at the info here and see if that answers the question for you.

* Pass mark - we have modified it so that a pass mark (as a %) can be set when setting up a quiz. Again, my apologies that I haven't been able to update this post due to my real work, I'll upload the new file on Monday.

The new file has also gotten rid of the need to change certain files as per the "read me" in the file above, should make it easier to install (if I remember correctly we merged it with the existing code so it would just be a straight overwrite and the database is taken care of on first run).

Hope it has been of some use to you, be back Monday smile

Regards
Harry


In reply to Just H

Re: Automatic email notification of a quiz on completion - screenshot

by jason mcnaughton -
Does this module also automatically email the student when they pass the quiz/class?
In reply to jason mcnaughton

Re: Automatic email notification of a quiz on completion - screenshot

by Just H -
Hi Jason

It doesn't . . . yet!

Reason being that we have assessments (quiz) set up to give feedback when submitted i.e. they get told there and then if they passed or failed. Doubt it would be a major problem adding that functionality.

If you need it, let me know what version of Moodle you are running and we'll see what we can do smile

H


In reply to Just H

Re: Automatic email notification of a quiz on completion - screenshot

by jason mcnaughton -
Is it also possible to notify the user that is taking the test/quiz that they passed?
In reply to jason mcnaughton

Re: Automatic email notification of a quiz on completion - screenshot

by Just H -
Hi Jason

As mentioned above, let me know what version of Moodle you are using and we'll see what we can do.

Regards
H
In reply to Just H

Re: Automatic email notification of a quiz on completion - screenshot

by Muhammad Zuberi -

Hi Harry,

I would like to have this functionality as well...I am using Moodle 1.8.2.

In reply to Muhammad Zuberi

Re: Automatic email notification of a quiz on completion - screenshot

by Just H -
Hi Muhammad

No worries, if we get time tomorrow we'll have a look at it and get back to you.

regards
H
In reply to Just H

Re: Automatic email notification of a quiz on completion - screenshot

by Kori Neill -

Hi Harry,

I saw that you have this on the site for 1.9, I was wondering if you are still able to send me the version for 1.8?

Thanks and I look forward to hearing from you.

Kori

In reply to Kori Neill

Re: Automatic email notification of a quiz on completion - screenshot

by Just H -
Hi Kori

You can grab the 1.8 version from the Modules and Plugins database.

We haven't touched it for months so the version there should be the latest but I'll double check when I get to work in the morning.

Regards
H
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Giorgos Fousekis -
Dear Harry

I use the quiz_notification in moodle 1.5.2 but with the submit of the quiz the field 'email_sent' in table `mdl_quiz_attempts` do not turn to '0'.
I followed all the instruction for the installation of quiz_notification.php.
When i manually change the 'email_sent' to '0' the quiz_notification works.
The test is only 1 attempt.

Regards
George
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Timothy Takemoto -
Nice one Harry,

I used to use quiztest before moodle and it used to send me email as each student took the test. It was nice to be able to give feeback. It made the process less mechanical, more encouraging, and enabled me to spot some cheats. It would be very nice to have. Even if I write to only one in ten of the students. I will try it out, one day soon.
In reply to Timothy Takemoto

Re: Automatic email notification of a quiz on completion

by Dr S Bhatia -
Hi Timothy
Nice to find another quiztest user. I was very impressed with quiztest and in fact I sometimes communicate with Kristina Pfaff-Harris who is the author of those scripts. Very thorough work she'd done.

Unfortunately, I used it rather sparingly because I was a member at quizstar and discovery school, too. And then I found Manhattan and banged my head with it for a long time uselessly. Then I graduated to Atutor and found it profound but less usable than Moodle. So finally settled on Moodle. This took me a six month long process.
But as far as individual testing is concerned, I'd still back quiztest any day for its robust and reliable structure, not to mention thoughtful layout and features.
In reply to Dr S Bhatia

Re: Automatic email notification of a quiz on completion

by Timothy Takemoto -

I have corresponded with Kristina Pfaff-Harris too. Please send her my regards should you get in touch with her again. Yes, it is good software.

Did you know it is based on ealier open source testing software by "Selina Sol" (a guy, Los Angeles written backwards) of Extropia
http://www.extropia.com/applications.html
Interestingly, as far as I am aware, Kristian Pfaff-Harris' software is not open source. Perhaps she used the Extropia code before it was GPLed.

It seems you came to moodle via the same route as me except you tried Manhattan more than I. I looked it, and decided it looked to complicated. It still took me 6 months to find moodle too.

Anway, email notification sounds like a good idea. Perhaps the volume of email will be so great as to make it infeasable in my case. It would be nice to send out notifactions of every nth student attempt.

Timothy

In reply to Timothy Takemoto

Re: Automatic email notification of a quiz on completion

by Dr S Bhatia -
smile

No I did not know about the topsy turvy Los Angeles.

In fact I ignored to mention that my first encounter was with 'Castle' but the download clearly mentioned that its dvelopment has been stopped. So i did not try it.

One of the reasons I came late to moodle was coz I had initially gone to Moodle.com and seeing the list of partners, i thought that probably moodle is free itself but you need to have an alliance with its partners to get it installed. Since I had none in India, I abondoned it.

I did inform Kristina of our conversation.
In reply to Timothy Takemoto

Re: Automatic email notification of a quiz on completion

by Just H -
Hi Timothy

I you haven't tried it yet, hold off until Monday. Will upload a new version as per my reply to Kyle above.

H
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Just H -
Afternoon all

Somewhat delayed but the latest version is ready to go smile

Rather than have a list of "replace this file" and "replace that file" we figured it would be easier to just replace the whole quiz directory which unfortunately, means the file is too big to attach here.

I have emailed it direct to you Timothy, Kyle, if you want to try it out please email via the link in my profile and I'll get it to you by return.

Anyone else interested please let me know via email.

Basically as per initial posting other than a pass mark can be nominated rather than default 100% and the files now take care of installation.

A readme is included in the zip with details of how to install, what is installed/changed and how to uninstall. For anyone interested I have attached it here.

Usual caveat applies, test it out on a test server before installing on a production server unless you are feeling brave. We take no responsibility for the end of the internet as we know it if we have somehow messed up smile

Works on 1.6.3 and 1.5+ (as far as we can test), haven't got 1.7 to test it on yet. Feedback much appreciated and if someone can point me in the right direction for an easy way to create a diff/patch file I'd also appreciate it (so I can send it to Tim Hunt to see what he thinks and hopefully get it included in standard quiz mod).

Hope it is of some use to you smile

Regards
Harry
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It is using a sledgehammer to crack a nut, but Eclipse makes it very easy to create patches. Of course, I think that beacuse I use Eclipse for everything and already have it set up.

However, if you want to try it there are detailed getting started instructions here: http://docs.moodle.org/en/Development:Setting_up_Eclipse which should make it easy.
In reply to Tim Hunt

Re: Automatic email notification of a quiz on completion

by Just H -
G'day Tim

I read your guide a while back and, as you say, seems like it is a tadge more than we need at the moment (we're just getting into this whole php and sql thing, basically the teams background is Flash development) plus being semi-government our firewall is a major pain in the proverbial which will take a while to "persuade" the powers that be to let us punch a whole in.

We've had a quick look at winmerge but unless we've missed something obvious it doesn't actually create patch files sad (think we need wget as well if I remember correctly). We'll find something eventually but our Moodle install still isn't actually official so we've had to put it on the backburner recently.
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well, if you and your team are used to the kind of integrated development environment you get when developing Flash, you might like Eclipse for working on PHP.

Installing Eclipse only requries downloading stuff with HTTP, which is port 80, which should not be a problem.

Using CVS would have to be let through the firewall, but surely only a really paranoid administrator would thing that CVS was a security risk.


The lowest-tech way to make and apply patches are to use the command line tools diff and patch. You seem to be able to download Windows versions here http://gnuwin32.sourceforge.net/packages/patch.htm and
http://gnuwin32.sourceforge.net/packages/diffutils.htm. You can also get them from Cygwin http://www.cygwin.com/.

The command will be something like

diff.exe -Naur standard_moodle_folder edited_moodle_folder > new-patch.txt


In reply to Tim Hunt

Re: Automatic email notification of a quiz on completion

by Just H -
Hi Tim

Thanks for the links smile WIll have a look when I get a chance. Eclipse does sound like an excellent tool once you get over the learning curve so we will be investigating it further down the track. At the moment we just want a quick simple way to supply you with a patch file so the other links may well hit the spot.

As for CVS being a security risk . . . you haven't met our IT department! sad

To be fair, we are a semi-government agency dealing with emergency management so the paranoia about security is understandable. At the moment, I'm trying to push Moodle but it's still an "unofficial pilot" that I have set up on an external server. Being unofficial and external, I can't even admin the site from work in certain cases (e.g. can't update via CVS) and the way they have Squid set up here means I can't even upload any files more than about 500kb.

On the plus side, it's been fun getting our heads around Moodle and I'll keep sniping away at our IT department until they give in smile

H
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Harry > ... I'll keep sniping away at our IT department until they give in...

That's the spirit!approve

Joseph

In reply to Just H

Re: Automatic email notification of a quiz on completion

by Luis Perez -

Hello Harry

Can you email me your last version of quiz_notification? I installed the first one and it is not working in 1.63+. No messages sent.

Luis Perez

lperezco@gmail.com

In reply to Luis Perez

Re: Automatic email notification of a quiz on completion

by Just H -
Just emailed, any problems let me know smile

H
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Luis Perez -

Hello

I found the following problems:

1. When a new quiz (event) is created is not included in the new events section.

2. Close and Open Quiz - when you make changes to these fields they are not saved. Problem with No time Limit.

3. Clock is not visible when taking the quiz. Probably due to 2 above.

Luis Perez

lperezco@gmail.com

In reply to Luis Perez

Re: Automatic email notification of a quiz on completionHi

by Just H -
Hi Luis

Sorry I missed this post, been a bit busy with "real" work here the past few weeks.

Thanks for letting us know about this, we'll look into it next week and get back to you.

Regards
Harry
In reply to Just H

Re: Automatic email notification of a quiz on completionHi

by Tony Ruggiero -

Hello Harry,

Can you email me your last version of quiz_notification?

Thanks,
Tony
tony@ruggieroconsulting.net
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Angelika Bodein -

Hello Harry,

Can you email me your last version of quiz_notification?

Thanks - Angelika
a.bodein@sonnenklar.net
In reply to Tim Hunt

Re: Automatic email notification of a quiz on completion

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Tim,

For amateur programmers like myself, reverting to the command line after getting used to the comfort of GUIs (Windows, etc.) can be daunting and the source of much frustration.angry

In order to get some of my hacks to be used for patching my university's Moodle installation, I've recently had to use those gnuwin32 tools you mention in your post. Took me half a day to figure out my way through the PATH, directory structure, numerous parameters of the command line, etc. But I finally managed. It's a pity that the only choice for producing DIFFs and PATCHes seems to be betwen the "prehistoric" command line on the one hand and sophisticated tools with a steep learning curve (Eclipse) on the other.

That's life.wink

Joseph

In reply to Joseph Rézeau

Re: Automatic email notification of a quiz on completion

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
But Eclipse does not have that steep a learning curve. And now there is my wonderful page of instructions (wink) taking you through it step by step, which makes the learning curve easy to climb. I think you could work through those instructions in half a day, and they tell you pretty much everything you need to know to use Eclipse for Moodle development.

It would also be valuable if you wanted to write up what you learned about using the command line tools to create a patch, and stick it on docs.moodle.org, so when other people are in the same situatino, they don't have to go through the same pain that you did.
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Luis Perez -

Hello Harry

Can you email me your last version of quiz_notification? I installed the first one and it is not working in 1.63+. No messages sent.

Luis Perez

In reply to Just H

Re: Automatic email notification of a quiz on completion

by Claire Browne -
Is there any chance for this type of script to be used when a new event in a calendar is created?

like a reminder?

The reason why I asked is that there is a reminder plugin but it is very flakey without support. I wondered if we could develop it to the calendar block?
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Andrzej L -

Hello Harry

Can you email me your last version of quiz_notification? I am interesting in this software.

Andrzej L
In reply to Andrzej L

Re: Automatic email notification of a quiz on completion

by Andrzej L -
My email cyklista@gmail.com.

Andrze L
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Tony Ruggiero -
Harry:

Installation went well on a 1.6.3 Moodle using a Windows box.

I set up Windows MoodleCron to call the quiz_notification.php page with no luck.

I did notice that all new entries to the "quiz_attempts" table are set to e-mail_results = Null. I changed the structure and defaulted it to "0".

Still no luck in getting the e-mails. I know the last time I played with a script to do this I had to init the SMTP server like this:

ini_set("SMTP","mail.rnfa.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","techsupport@rnfa.org");

This allows systems that won't forward mail to use the script and it worked well.

Any ideas why I am not getting the e-mails out?

Thanks,
Tony
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Antonius Dilly -
Hi Harry, I'm a new user of moodle. i have an e-learning project. I'm running my moodle in local server. I was so happy when i knew that Moodle has provided module quiz_email_notification, coz i want admin also receive email contains the quia answer from the student. I have followed the installation guide. It did well. But when i tried to attempt the quiz, there was no email notification received by admin (i set the email destination to admin). What is the problem? I need help. TQ
In reply to Antonius Dilly

Re: Automatic email notification of a quiz on completion

by Peter Lindop -

Hi Antonius

I am open to correction, but I think that these notifications only happen when a student is doing the quiz.  I have created myself a student profile as well to make sure that everything works from that perspective. 

There is also Swith Role To function on the header bar of the course, but I haven't tested whether this affects e-mail notifications before.

Peter

In reply to Peter Lindop

Re: Automatic email notification of a quiz on completion

by Antonius Dilly -
Hi Peter...
Thx u for ur comment. I have tried login as a student and comlpeted the quiz. But it didnt work.
Just for u to know, after i installed this module, something weird is happened, admin notification became blank. Does anybody know how to solve this problem? I'm running moodle 1.8, using module quiz_auto_notification v1.8.
In reply to Antonius Dilly

Re: Automatic email notification of a quiz on completion

by Graham Miller -
As I have not checked the OP I am not sure this is valid or not. But if you are after simple templated email notification to teacher and/or student, then there is a patch for version 1.8.2 and the same code is built into version 1.9 which does this fairly easily using the role overrides.

See this link for the "how to" and this link for the tracker where you can find the patch for 1.8.2.


Graham
In reply to Antonius Dilly

Re: Automatic email notification of a quiz on completion

by Just H -
Hi Antonius

Not sure if you got the IM or not, if not see below:

Wednesday, 3 October 2007

Harry Smith [12:07 AM]: Evening Antonius

Sorry to hear you are having trouble with it sad

We're still running Moodle 1.6 so the version has had very little testing on 1.8 as our test server has been down for some time.

"Admin notification page became blank." That is very strange as the hack doesn't touch any files to do with that as far as I can remember. Other that trying out the quiz notification, is there anything else you've done recently?

"No email notification received" Have you set up the cron job to execute quiz_notification.php?

Regards
Harry

In reply to Just H

Re: Automatic email notification of a quiz on completion

by Shail Jai -
page blank becose of lib.php page ....
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Tim Florian -
Is this notification feature available in 1.9 yet?
In reply to Tim Florian

Re: Automatic email notification of a quiz on completion

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
In reply to Tim Hunt

Re: Automatic email notification of a quiz on completion

by Tim Florian -

If I am reading this correctly, the system will generate an email with the quiz.php language file information automatically is I change the roles override feature from inherent to allow. Is that correct?

Thanks for the information

In reply to Tim Florian

Re: Automatic email notification of a quiz on completion

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Yes, that is correct.
In reply to Tim Hunt

Re: Automatic email notification of a quiz on completion

by Shail Jai -
it's not working... admin still not gettting any mail
In reply to Just H

Re: Automatic email notification of a quiz on completion

by Suzy Bills -
I am interested in getting the script you used to automatically notify people when a student passed/failed a course. Is it posted on this site somewhere? Can I get access to it?

Thanks!