Saltar al contenido principal

Function: messageParticipants()

function messageParticipants(
context,
siteUrl,
courseId,
text,
selection?
): Promise<{
changed: string;
refused: object[];
sentTo: number[];
}>;

Defined in: areas/messages/messages.ts:282

Sends one message to several participants of a course, as the participants page's "Send a message" does for the users selected: one private message each, in one call. They are userIds, or the participants participants() chooses with role, group and inactiveSince (all of them when none is given), the person left out. sentTo lists exactly who got it, refused who Moodle didn't write to and why (they blocked the person, their privacy settings); someone who may message any user (a teacher, moodle/site:messageanyuser) gets through a block, as in Moodle's own page (confirmed empirically, Moodle 5.2). Throws MessageError for an empty message or nobody to write to, NoParticipantsError when the person can't see the course's participants.

Parameters​

ParameterType
contextBrowserContext
siteUrlstring
courseIdnumber
textstring
selectionParticipantSelection

Returns​

Promise<{ changed: string; refused: object[]; sentTo: number[]; }>