diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index 02f5fea995c..f2f93031ffb 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -476,6 +476,9 @@ function forum_cron() {
         }
     }
 
+    $USER = clone($cronuser);
+    course_setup(SITEID);
+
     $sitetimezone = $CFG->timezone;
 
     /// Now see if there are any digest mails waiting to be sent, and if we should send them