onCommentMarkedAsBest( )


A backend event that fires when a forum comment is marked as best.

The onCommentMarkedAsBest() event handler runs when an existing forum comment in your site is marked as best. The received MarkedAsBestComment object contains information about the comment that was marked as best.

Notes:

  • Only comments on posts with a postType of "QUESTION" can be marked as best.

  • Backend events are not fired when previewing your site.

Method Declaration
Copy
function onCommentMarkedAsBest(event: MarkedAsBestComment): void;
Method Parameters
eventMarkedAsBestCommentRequired

Information about the forum comment that was marked as best.

A backend event that occurs when a forum comment is marked as best
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onCommentMarkedAsBest(event) { const bestCommentId = event.commentId; console.log("Comment marked as best"); }
Did this help?

onCommentReported( )


A backend event that fires when a forum comment is reported.

The onCommentReported() event handler runs when a site visitor reports a comment on your site. The received ReportedComment object contains information about the comment that was reported.

Note: Backend events are not fired when previewing your site.

Method Declaration
Copy
function onCommentReported(event: ReportedComment): void;
Method Parameters
eventReportedCommentRequired

Information about the forum comment that was reported.

A backend event that occurs when a forum comment is reported
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onCommentReported(event) { const reportedCommentId = event.commentId; const typeOfReport = event.reportType; console.log("Comment reported"); }
Did this help?

onCommentUnliked( )


A backend event that fires when a forum comment is unliked.

The onCommentUnliked() event handler runs when a like is removed from an existing forum comment in your site. The received UnlikedComment object contains information about the comment that was unliked.

Note: Backend events are not fired when previewing your site.

Method Declaration
Copy
function onCommentUnliked(event: UnlikedComment): void;
Method Parameters
eventUnlikedCommentRequired

Information about the forum comment that was unliked.

A backend event that occurs when a forum comment is unliked
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onCommentUnliked(event) { const unlikedCommentId = event.commentId; console.log("Comment unliked"); }
Did this help?

onCommentUnmarkedAsBest( )


A backend event that fires when a forum comment is unmarked as best.

The onCommentUnmarkedAsBest() event handler runs when an existing forum comment in your site is unmarked as best. The received UnmarkedAsBestComment object contains information about the comment that was unmarked as best.

Notes:

  • Only comments on posts with a postType of "QUESTION" can be marked and unmarked as best.

  • Backend events are not fired when previewing your site.

Method Declaration
Copy
function onCommentUnmarkedAsBest(event: UnmarkedAsBestComment): void;
Method Parameters
eventUnmarkedAsBestCommentRequired

Information about the forum comment that was unmarked as best.

A backend event that occurs when a forum comment is unmarked as best
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onCommentUnmarkedAsBest(event) { const unmarkedCommentId = event.commentId; console.log("Comment unmarked as best"); }
Did this help?

onCommentUnvoted( )


A backend event that fires when a vote is removed from a forum comment.

The onCommentUnvoted() event handler runs when a vote is removed from a forum comment. The received UnvotedComment object contains information about the comment that was unvoted.

Notes:

  • Only comments on posts with a postType of "QUESTION" can be voted on.

  • Backend events are not fired when previewing your site.

Method Declaration
Copy
function onCommentUnvoted(event: UnvotedComment): void;
Method Parameters
eventUnvotedCommentRequired

Information about the forum comment that was upvoted.

A backend event that occurs when a forum comment is upvoted
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onCommentUpvoted(event) { const upvotedCommentId = event.commentId; console.log("Comment upvoted"); }
Did this help?

onCommentUpdated( )


A backend event that fires when a forum comment is updated.

The onCommentUpdated() event handler runs when a an existing forum comment in your site is updated. The received UpdatedComment object contains information about the comment that was updated.

Note: Backend events are not fired when previewing your site.

Method Declaration
Copy
function onCommentUpdated(event: UpdatedComment): void;
Method Parameters
eventUpdatedCommentRequired

Information about the forum comment that was updated.

A backend event that occurs when a forum comment is updated
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onCommentUpdated(event) { const commentId = event.commentId; const commentText = event.comment.plainContent; } /* Full comment object: * { * "_id": "5f88058be9b6b100175b154c", * "postId":"5f88058be9b6b100175b154a", * "_ownerId":"32cf071a-ck2f-450f-ad74-5a25db0b1b6g", * "plainContent": "This is my updated comment text.", * "replyCount": 2, * "likeCount": 5, * "upvoteCount": 4, * "downvoteCount": 6, * "score": -2, * "_createdDate": "2020-10-26T07:18:20.297Z", * "_editedDate": "2020-11-04T12:27:05.592Z", * "_lastActivityDate": "2020-11-04T12:27:05.592Z", * "pageUrl": "/forum/main/comment/5f88058be9b6b100175b154c" * } */
Did this help?