Documentation

ForumAddMessage

int
ForumAddMessage(
 string MESSAGE_TYPE,
 int FID,
 int TID,
 int MID,
 array arFieldsG,
 &string strErrorMessage,
 &string strOKMessage [,
 int iFileSize]
);

The function ForumAddMessage adds or modifies a forum post (and/or topic). The function appends description of errors to strErrorMessage, and reports of the function successful execution to strOKMessage.

Parameters

ParameterDescription
MESSAGE_TYPE Type of action. The following values are possible:
  • NEW - creates of a new topic and adds a post to it;
  • EDIT - modifies a post (and a topic if the user has corresponding permissions);
  • REPLY - adds a new post to an existing topic.
FID The ID of the forum to which a new topic is added. Should be specified for the "NEW" MESSAGE TYPE.
TID The ID of the topic to which the message is added. Should be specified for the "REPLY" MESSAGE TYPE, or to 0 for the "NEW" MESSAGE TYPE.
MID The ID of the message to modify. Should be specified for the "ADD" MESSAGE TYPE, or to 0 for other values.
arFieldsG Array containing parameters of the message and topic. Should contain the following keys:
  • POST_MESSAGE - the message body;
  • TITLE - the topic title (for NEW and EDIT and if the topic modification is permitted);
  • AUTHOR_NAME - the message author name;
  • DESCRIPTION - the topic description (for NEW and EDIT and if the topic modification is permitted);
  • ICON_ID - the topic icon ID (for NEW and EDIT and if the topic modification is permitted);
  • USE_SMILES - allow replacing smiles with icons;
  • ATTACH_IMG - attached file; an array having the same structure as $_FILES.
strErrorMessage On return, this variable contains description of errors, if any occurs.
strOKMessage On return, this variable contains description of the successful run.
iFileSize Max size of files allowed for upload. Optional, 50000 bytes by default.

Return Values

Returns the ID of the message on success or false otherwise.
© «Bitrix24», 2001-2024
Up