diff --git a/main/cron/import_csv.php b/main/cron/import_csv.php index 9d3fdce9c7..9024a765f0 100755 --- a/main/cron/import_csv.php +++ b/main/cron/import_csv.php @@ -1053,7 +1053,12 @@ class ImportCsv $event['session_id'], $subject, $emailBody, - ['everyone'] + ['everyone'], + [], + null, + null, + false, + $this->defaultAdminId ); if ($announcementId) { diff --git a/main/inc/lib/AnnouncementManager.php b/main/inc/lib/AnnouncementManager.php index 9f4e782fe4..3393580d01 100755 --- a/main/inc/lib/AnnouncementManager.php +++ b/main/inc/lib/AnnouncementManager.php @@ -413,6 +413,8 @@ class AnnouncementManager * @param string $file_comment Comment describing the attachment * @param string $end_date * @param bool $sendToUsersInSession + * @param int $authorId + * * @return int false on failure, ID of the announcement on success */ public static function add_announcement( @@ -424,7 +426,8 @@ class AnnouncementManager $file = array(), $file_comment = null, $end_date = null, - $sendToUsersInSession = false + $sendToUsersInSession = false, + $authorId = 0 ) { if (empty($courseInfo)) { return false; @@ -433,7 +436,7 @@ class AnnouncementManager $course_id = $courseInfo['real_id']; $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); - $authorId = api_get_user_id(); + $authorId = empty($authorId) ? api_get_user_id() : $authorId; if (empty($end_date)) { $end_date = api_get_utc_datetime();