Search.../

onCategoryUpdated( )

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

Description

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

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

Syntax

function onCategoryUpdated(event: UpdatedCategory): void

onCategoryUpdated Parameters

NAME
TYPE
DESCRIPTION
event
UpdatedCategory

Information about the forum category that was updated.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

A backend event that occurs when a forum category is updated

In this example, the category header background is an image.

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_onCategoryUpdated(event) {
5 const categoryId = event.categoryId;
6 const categoryName = event.category.name;
7}
8
9/* Full category object:
10 * {
11 * "_id": "5f88058be9b6b100175b154d",
12 * "name": "My Updated Category Name",
13 * "headerTitle": "My Updated Category Header Title",
14 * "description": "This is a description of my category.",
15 * "headerType": "IMAGE",
16 * "headerImage": "wix:image://v1/a27d24_3...46~mv2.jpg/_.jpg#originWidth=940&originHeight=529",
17 * "headerImageOverlayColor": {
18 * "color": "#40E0D0",
19 * "opacity": 0.1
20 * },
21 * "rank": 2,
22 * "slug": "my-updated-category-name",
23 * "pageUrl": "/forum/my-updated-category-name",
24 * "postCount": 3,
25 * "postViewCount": 56,
26 * "writeProtected": "true",
27 * "_createdDate": "2020-10-26T07:18:20.297Z",
28 * "_updatedDate": "2020-11-04T12:27:05.592Z"
29 * }
30 */
31
A backend event that occurs when a forum category is updated

In this example, the category header background is a color.

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_onCategoryUpdated(event) {
5 const categoryId = event.categoryId;
6 const categoryName = event.category.name;
7}
8
9/* Full category object:
10 * {
11 * "_id": "5f88058be9b6b100175b154d",
12 * "name": "My Updated Category Name",
13 * "headerTitle": "My Updated Category Header Title",
14 * "description": "This is a description of my category.",
15 * "headerType": "COLOR",
16 * "headerBackgroundColor": {
17 * "color": "#8F98E2",
18 * "opacity": 0.5
19 * },
20 * "headerTextColor": {
21 * "color": "#9E3B1B",
22 * "opacity": 1
23 * },
24 * "rank": 2,
25 * "slug": "my-updated-category-name",
26 * "pageUrl": "/forum/my-updated-category-name",
27 * "postCount": 12,
28 * "postViewCount": 144,
29 * "writeProtected": "false",
30 * "_createdDate": "2020-10-26T07:18:20.297Z",
31 * "_updatedDate": "2020-11-04T12:27:05.592Z"
32 * }
33 */
34