Monday, March 19, 2012

Sending an E-mail notification to a student in David Mudrak's Stamp Collection module for Moodle 2.2!

I've discovered how to send an E-mail notification for David Mudrak's Stamp Collection module for Moodle 2.2. It's really easy. All you need to do is to copy this code: 

  //E-mail notification!
  $user = $DB->get_record('user', array('id' => $data->userto));
  $subjectOfMsg = $USER->firstname." ".$USER->lastname."'s just given you a NEW STAMP in".$course->shortname;
  $success = email_to_user($user, $USER, $subjectOfMsg, $data->text);
  if ($success == "1") 
     echo "E-mail successful sent to ".$user->firstname." ".$user->lastname."!";
  } else if ($success === "emailstop") {
            echo "E-mail of ".$user->firstname." ".$user->lastname." has been DISABLED!"
            .'E-mail NOT sent';
         } else if (!$success){
                  echo "Error: E-mail unsuccessful.";
  //email end

and paste it into line 67 of the addstamp.php file of the Moodle 2.2 version of the Stamp Collection. Like so:

Next, save the file and then MAKE A BACKUP OF YOUR ORIGINAL addstamp.php!!
Ftp the modified file into the http://YourMoodleSite/mod/stampcoll.
You can click the link below to download my modified addstamp.php file.

Remember! It's for Moodle 2.2.

If you like this post or site
a small donation would be nice but would last only a day,
otherwise leaving a comment (or a compliment) below will last me a month!

Ratings and Recommendations by outbrain