onCommentUpvoted( )


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

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.

Method Declaration
Copy
function onCommentUpvoted(event: UpvotedComment): void;
Method Parameters
eventUpvotedCommentRequired

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?

onPostClosed( )


A backend event that fires when a forum post is closed.

The onPostClosed() event handler runs when an existing forum post in your site is closed. When a forum post is closed, members can't comment on the post. The received ClosedPost object contains information about the post that was closed.

Notes:

  • By default, forum posts are open.

  • Backend events are not fired when previewing your site.

Method Declaration
Copy
function onPostClosed(event: ClosedPost): void;
Method Parameters
eventClosedPostRequired

Information about the forum post that was closed.

A backend event that occurs when a forum post is closed
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onPostClosed(event) { const closedPostId = event.postId; console.log("Post closed to comments"); }
Did this help?

onPostCreated( )


A backend event that fires when a new forum post is created.

The onPostCreated() event handler runs when a new forum post is created in your site. The received CreatedPost object contains information about the new post that was created.

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

Method Declaration
Copy
function onPostCreated(event: CreatedPost): void;
Method Parameters
eventCreatedPostRequired

Information about the forum post that was created.

A backend event that occurs when a new forum post is created
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onPostCreated(event) { const postId = event.postId; const postPageUrl = event.post.pageUrl; } /* Full post object: * { * "_id": "5f88058be9b6b100175b154c", * "categoryId":"5f88058be9b6b100175b154a", * "_ownerId":"32cf071a-ck2f-450f-ad74-5a25db0b1b6g", * "title": "What topics should we discuss?", * "plainContent": "Let us know what you think in the comments below.", * "pinned": "false", * "commentingDisabled": "false", * "commentCount": 0, * "likeCount": 0, * "viewCount": 0, * "_createdDate": "2020-10-26T07:18:20.297Z", * "_editedDate": null, * "_lastActivityDate": "2020-10-26T07:18:20.297Z", * "slug": "what-topics-should-we-discus", * "pageUrl": "/forum/category-name/what-topics-should-we-discuss", * "postType": "QUESTION" * } */
Did this help?

onPostDeleted( )


A backend event that fires when a forum post is deleted.

The onPostDeleted() event handler runs when an existing forum post in your site is deleted. The received DeletedPost object contains information about the post that was deleted.

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

Method Declaration
Copy
function onPostDeleted(event: DeletedPost): void;
Method Parameters
eventDeletedPostRequired

Information about the forum post that was deleted.

A backend event that occurs when a forum post is deleted
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onPostDeleted(event) { const deletedPostId = event.postId; console.log("Post deleted"); }
Did this help?

onPostLiked( )


A backend event that fires when a forum post is liked.

The onPostLiked() event handler runs when an existing forum post in your site is liked. The received LikedPost object contains information about the post that was liked.

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

Method Declaration
Copy
function onPostLiked(event: LikedPost): void;
Method Parameters
eventLikedPostRequired

Information about the forum post that was liked.

A backend event that occurs when a forum post is liked
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onPostLiked(event) { const likedPostId = event.postId; console.log("Post liked"); }
Did this help?

onPostMoved( )


A backend event that fires when a forum post is moved.

The onPostMoved() event handler runs when an existing forum post in your site is moved to a different category. The received MovedPost object contains information about the post that was moved.

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

Method Declaration
Copy
function onPostMoved(event: MovedPost): void;
Method Parameters
eventMovedPostRequired

Information about the forum post that was moved.

A backend event that occurs when a forum post is moved
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onPostMoved(event) { const movedPostId = event.postId; const oldCategory = event.previousCategoryId; const newCategory = event.currentCategoryId; console.log("Post moved"); }
Did this help?

onPostOpened( )


A backend event that fires when a forum post is opened.

The onPostOpened() event handler runs when an existing forum post in your site is opened. When a forum post is open, members can comment on the post. The received OpenedPost object contains information about the post that was opened.

Notes:

  • By default, forum posts are open.

  • Backend events are not fired when previewing your site.

Method Declaration
Copy
function onPostOpened(event: OpenedPost): void;
Method Parameters
eventOpenedPostRequired

Information about the forum post that was opened.

A backend event that occurs when a forum post is opened
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onPostOpened(event) { const openedPostId = event.postId; console.log("Post open to comments"); }
Did this help?

onPostPinned( )


A backend event that fires when a forum post is pinned.

The onPostPinned() event handler runs when an existing forum post in your site is pinned. Only forum admins can pin posts. The received PinnedPost object contains information about the post that was pinned.

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

Method Declaration
Copy
function onPostPinned(event: PinnedPost): void;
Method Parameters
eventPinnedPostRequired

Information about the forum post that was pinned.

A backend event that occurs when a forum post is pinned
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onPostPinned(event) { const pinnedPostId = event.postId; console.log("Post pinned"); }
Did this help?

onPostReported( )


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

The onPostReported() event handler runs when a site visitor reports a post on your site. The received ReportedPost object contains information about the post that was reported.

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

Method Declaration
Copy
function onPostReported(event: ReportedPost): void;
Method Parameters
eventReportedPostRequired

Information about the forum post that was reported.

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

onPostUnliked( )


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

The onPostUnliked() event handler runs when a like is removed from a forum post in your site. The received UnlikedPost object contains information about the post that was unliked.

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

Method Declaration
Copy
function onPostUnliked(event: UnlikedPost): void;
Method Parameters
eventUnlikedPostRequired

Information about the forum post that was unliked.

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

onPostUnpinned( )


A backend event that fires when a forum post is unpinned.

The onPostUnpinned() event handler runs when an existing forum post in your site is unpinned. Only forum admins can unpin posts. The received UnpinnedPost object contains information about the post that was unpinned.

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

Method Declaration
Copy
function onPostUnpinned(event: UnpinnedPost): void;
Method Parameters
eventUnpinnedPostRequired

Information about the forum post that was unpinned.

A backend event that occurs when a forum post is unpinned
JavaScript
// Place this code in a file named events.js // in the Backend section of your code files. export function wixForum_onPostUnpinned(event) { const unpinnedPostId = event.postId; console.log("Post unpinned"); }
Did this help?