Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Course Completion Warning (completion_warn_user) not sending #1969

Open
andyr74 opened this issue Apr 19, 2024 · 6 comments
Open

User Course Completion Warning (completion_warn_user) not sending #1969

andyr74 opened this issue Apr 19, 2024 · 6 comments

Comments

@andyr74
Copy link

andyr74 commented Apr 19, 2024

I have configured this email User Course Completion Warning (completion_warn_user) to send on a daily basis however it doesnt appear to be working. Users do not receive the email and does not show as sent in the email send reports so presume for whatever reason the email is not being triggered

We are using license based course assignments with instant access and a limited access . Is this the reason? does it only work for courses assigned rather than licenses>>> if so is there another email which will do the same for license based assignments.

@turf212
Copy link
Collaborator

turf212 commented Apr 22, 2024

The enrolment method wont make a difference to this. One thing which could be tripping you up is if you changed this after the initial email was sent out. There is a field in the local_iomad_track table completedstop which controls whether these emails get resent.

If they have never been sent - check that your cron is running and that the \local_email_reports\task\course_not_completed_task
is running OK. FYI if you se the path to php in Site admin -> server -> system paths, you can run this by hand and it may help as to why it's failing.

@MarkTallentire
Copy link

MarkTallentire commented Apr 22, 2024

/o @turf212

I've tried running the above command and get the following error, am i missing something with the path here? I can see the file physically at local/email_reports/classes/task/course_not_completed_task but cant get it to execute using:

php admin/cli/scheduled_task.php --execute='local/email_reports/classes/task/course_not_completed_task'

error: Task 'local/email_reports/classes/task/course_not_completed_task' not found

I've tried a few variations on the path including php admin/cli/scheduled_task.php --execute='local/email_reports/classes/task/course_not_completed_task'

and running it without going through admin/cli/scheduled_task.php but to no avail.

Without the admin/cli/scheduled_task.php the error is:

PHP Fatal error: Uncaught Error: Class "core\task\scheduled_task" not found in <redacted>/local/email_reports/classes/task/course_not_completed_task.php:30 Stack trace: #0 {main} thrown in <redacted>/local/email_reports/classes/task/course_not_completed_task.php on line 30

@turf212
Copy link
Collaborator

turf212 commented Apr 22, 2024

@MarkTallentire What version of IOMAD do you have installed? I've tested this locally on latest 4.1, 4.2 and 4.3 and the task can run successfully vi the Site admin -> scheduled tasks page.

@andyr74
Copy link
Author

andyr74 commented Apr 22, 2024

Yes, using 4.2.6.

Ok, ignore the previous error, the scheduled tasks are actually running. As confirmed here

"Execute scheduled task: Email reports - Course not completed task (local_email_reports\task\course_not_completed_task)
... started 00:00:03. Current memory use 31.0 MB.
Running email report course not completed task at 02 Apr 2024 12:00:03
sending user completion warning emails
sending completion warning emails to the managers
email reporting course not completed warning task completed at 02 Apr 2024 12:00:03
... used 3 dbqueries
... used 0.00087499618530273 seconds
Scheduled task complete: Email reports - Course not completed task (local_email_reports\task\course_not_completed_task)"

Other email templates are sending fine, so it seems we aren't triggering the user_course_completion_warning template, what is the specific criteria to make this trigger?

@turf212
Copy link
Collaborator

turf212 commented Apr 22, 2024

If you go to the IOMAD dashboard, courses tab and manage IOMAD course settings. There is an option on that page to send an email if the course is nut completed by X days. You need to turn editing on to change it.

You also need to ensure that the course completion warning email template is enabled.

@MarkTallentire
Copy link

@turf212 Hi Derick. Thanks for all your help so far. We've now got to the point where we can see the email attempting to send but get the below error in the logs:

Execute scheduled task: Email reports - Course not completed task (local_email_reports\task\course_not_completed_task)
... started 06:38:41. Current memory use 23.9 MB.
Debugging increased temporarily due to faildelay of 30720
Running email report course not completed task at 25 Apr 2024 06:38:41
sending user completion warning emails
Sending completion warning email to <redacted>@gmail.com
... used 20 dbqueries
... used 0.04552698135376 seconds
Scheduled task failed: Email reports - Course not completed task (local_email_reports\task\course_not_completed_task),method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
Backtrace:
* line 161 of /local/email/lib/vars.php: call to method_exists()
* line 1002 of /local/email/lib/api.php: call to EmailVars->__get()
* line 256 of /local/email/lib/api.php: call to EmailTemplate->fill()
* line 281 of /local/email/lib/api.php: call to EmailTemplate->body()
* line 109 of /local/email/lib/api.php: call to EmailTemplate->queue_for_cron()
* line 174 of /local/email_reports/classes/task/course_not_completed_task.php: call to EmailTemplate::send()
* line 405 of /lib/classes/cron.php: call to local_email_reports\task\course_not_completed_task->execute()
* line 208 of /lib/classes/cron.php: call to core\cron::run_inner_scheduled_task()
* line 125 of /lib/classes/cron.php: call to core\cron::run_scheduled_tasks()
* line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()

Can confirm that the template appears active and the users email etc is all correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants