Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-4892

Certificate email functionality is no longer working

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6, 2.6.1
    • Fix Version/s: None
    • Component/s: Module: Certificate
    • Labels:
      None
    • Affected Branches:
      MOODLE_26_STABLE

      Description

      The certificate_email_others function in mod/certificate/lib.php is now broken
      Error displayed:
      Can not send email to null user

      line 5677 of \lib\moodlelib.php: call to debugging()
      line 392 of \mod\certificate\lib.php: call to email_to_user()
      line 658 of \mod\certificate\lib.php: call to certificate_email_others()
      line 88 of \mod\certificate\view.php: call to certificate_get_issue()

      This is because this function is somewhat abusing email_to user passing a record with just email set as the first parameter
      So it fails the first verification test line 5671 of lib/moodllib.php
      A possible solution could be to pass a more complete fake user with all needed values set (id and possibly others).

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              markn Mark Nelson added a comment -

              Thanks Jean, I saw the solution you proposed on the forums which seems fine for me considering this is a hacky way to send emails to begin with. Would you like to create a pull request on github that I can pull?

              Show
              markn Mark Nelson added a comment - Thanks Jean, I saw the solution you proposed on the forums which seems fine for me considering this is a hacky way to send emails to begin with. Would you like to create a pull request on github that I can pull?
              Hide
              jmvedrine Jean-Michel Vedrine added a comment -

              Hello Mark, I saw you edited this issue's title.
              For me only the "email others" function is broken, the others are working fine (because they pass a full user record to email_to_user).
              Do you think there are other email related problems in the certificate module ?
              I will create a pull request as soon as I know how to do it because I never did that in fact !

              Show
              jmvedrine Jean-Michel Vedrine added a comment - Hello Mark, I saw you edited this issue's title. For me only the "email others" function is broken, the others are working fine (because they pass a full user record to email_to_user). Do you think there are other email related problems in the certificate module ? I will create a pull request as soon as I know how to do it because I never did that in fact !
              Hide
              markn Mark Nelson added a comment -

              Hey Jean, thanks for your contribution! I have merged this into master. You may be correct about only the email to others functionality being broken, and the others working. Tbh, I did not check the others either. Oh well, it's only a title .. thanks

              Show
              markn Mark Nelson added a comment - Hey Jean, thanks for your contribution! I have merged this into master. You may be correct about only the email to others functionality being broken, and the others working. Tbh, I did not check the others either. Oh well, it's only a title .. thanks

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: