Skip to content

Commit f7e7b7d

Browse files
committed
Fix unsent message (set correct sender id) see BT#14323
1 parent a0eb15a commit f7e7b7d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

main/inc/lib/ScheduledAnnouncement.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,11 @@ public function getAttachment($id)
289289

290290
/**
291291
* @param int $urlId
292+
* @param int $senderId
292293
*
293294
* @return int
294295
*/
295-
public function sendPendingMessages($urlId = 0)
296+
public function sendPendingMessages($urlId = 0, $senderId = 0)
296297
{
297298
if (!$this->allowed()) {
298299
return 0;
@@ -321,13 +322,11 @@ public function sendPendingMessages($urlId = 0)
321322
continue;
322323
}
323324

324-
$attachments = $this->getAttachmentToString($result['id']);
325-
326-
self::update(['id' => $result['id'], 'sent' => 1]);
327-
328-
$subject = $result['subject'];
329-
330325
if ($users) {
326+
self::update(['id' => $result['id'], 'sent' => 1]);
327+
$attachments = $this->getAttachmentToString($result['id']);
328+
$subject = $result['subject'];
329+
331330
foreach ($users as $user) {
332331
// Take original message
333332
$message = $result['message'];
@@ -393,10 +392,11 @@ public function sendPendingMessages($urlId = 0)
393392
$message = str_replace(array_keys($tags), $tags, $message);
394393
$message .= $attachments;
395394

396-
MessageManager::send_message(
395+
MessageManager::send_message_simple(
397396
$userInfo['user_id'],
398397
$subject,
399-
$message
398+
$message,
399+
$senderId
400400
);
401401
}
402402
}

0 commit comments

Comments
 (0)