Certificate - Email delivery - Cannot write to database Error

Certificate - Email delivery - Cannot write to database Error

by Nano A -
Number of replies: 6

 

I've read that some people are using email delivery, but I can't seem to have it to work.

 

I'm using Moodle 2.2.3 and certificate 2012060901

 

When I choose email delivery I get this error

Error writing to database

 

Debug says:  Notice: Undefined index: mailed in /'mymoodlesite'/lib/dml/mysqli_native_moodle_database.php on line 1056

Debug info: Unknown column 'mailed' in 'field list'
UPDATE mdl_certificate_issues SET mailed = ? WHERE certificateid = ? AND userid = ?
[array (
0 => '1',
1 => '4',
2 => '2',
)]
Stack trace:
  • line 397 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 1071 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1482 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->set_field_select()
  • line 501 of /mod/certificate/lib.php: call to moodle_database->set_field()
  • line 116 of /mod/certificate/view.php: call to certificate_email_student()

 

I don't know how to read this.  

Can anybody help?

 

Thanks!

Average of ratings: -
In reply to Nano A

Re: Certificate - Email delivery - Cannot write to database Error

by tim st.clair -
Picture of Plugin developers

I can't see that column in my db either, I haven't upgraded yet so good to see that this might be an issue.

The error is saying:

  • in the table called "mdl_certificate_issues"
  • I can't see a column called "mailed"
  • so I can't store that data

Basically, if you had access to your database, you could add the extra column to that table; I'm guessing that the sql statement you would need to run to make this error go away would be something like:

ALTER TABLE `mdl_certificate_issues` ADD COLUMN `mailed` tinyint(1) unsigned NOT NULL DEFAULT '0'

But we should check with the plugin creator (https://github.com/PukunuiAustralia/moodle-mod_certificate) to check out if there are any other changes that have been missed.

In reply to Nano A

Re: Certificate - Email delivery - Cannot write to database Error

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

The mailed column was removed in the latest release due to not being needed, any references to that column should have been removed from the code. It seems I missed the set_field call, thanks for pointing this out. I am pushing a fix shortly.

In reply to Nano A

Re: Certificate - Email delivery - Cannot write to database Error

by Nano A -

Thank you both! 

I think I'll try Tim's suggestion because I need to have this working now, and when it's fixed removing that extra column from the table should bring things back to normal, right?

In reply to Nano A

Re: Certificate - Email delivery - Cannot write to database Error

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Nano,

I have already pushed a fix to https://github.com/PukunuiAustralia/moodle-mod_certificate

Regards,

Mark

In reply to Mark Nelson

Re: Certificate - Email delivery - Cannot write to database Error

by Nano A -

That was quick!  Thank you!

Now that you are here, can I ask you something?  I saw a post you made regarding some modifications you're planning to the plugin.  They looked really cool, but the posts are a few months old.  Is this something you're still working on?  or has this been postponed?

In reply to Nano A

Re: Certificate - Email delivery - Cannot write to database Error

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

I will be responding to that thread shortly. smile