Documentation

CreateMessage

bool
CSocNetMessages::CreateMessage(
 int senderUserId,
 int targetUserID,
 string message
);

This helper method is used to send personal message from one social network user to another. Non-static method.

Note: the method [link=191236]CSocNetMessages::Add[/link] is used to send a system message.
The following events are called when executing the method: [link=191899]OnBeforeSocNetMessagesAdd[/link] and [link=191912]OnSocNetMessagesAdd[/link].

Parameters

Parameter Description Available from version
senderUserId Message sending user ID.
targetUserID Message recipient user ID.
message Message text.

Returned value

The method returns true on successful saved message and returns false otherwise.

See Also

  • [link=191236]CSocNetMessages::Add[/link]

Examples

<?
if (!CSocNetMessages::CreateMessage($GLOBALS["USER"]->GetID(), $userId, $message))
{
	if ($e = $GLOBALS["APPLICATION"]->GetException())
		$errorMessage .= $e->GetString();
}
?>


© «Bitrix24», 2001-2024
Up