Search.../

onCommentUpvoted( )

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

Description

The onCommentUpvoted() event handler runs when an existing forum comment in your site is upvoted. The received UpvotedComment object contains information about the comment that was upvoted.

Notes:

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

  • Backend events are not fired when previewing your site.

Syntax

function onCommentUpvoted(event: UpvotedComment): void

onCommentUpvoted Parameters

NAME
TYPE
DESCRIPTION
event
UpvotedComment

Information about the forum comment that was upvoted.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

A backend event that occurs when a forum comment is upvoted

Copy Code
1// Place this code in a file named events.js
2// in the Backend section of your code files.
3
4export function wixForum_onCommentUpvoted(event) {
5 const upvotedCommentId = event.commentId;
6 console.log("Comment upvoted");
7}