updateBadgesDisplayOrder( )


Updates badges' display order.

The badgeId parameter must be an ID from your site's Members/Badges collection. Typically, you retrieve the ID from the collection using a query or through a dataset.

This function is not a universal function and runs only on the backend

Authentication
  • When developing websites or building an app with Blocks, this method may require elevated permissions, depending on the identity of the user calling it and the calling user’s permissions.
  • When building apps without Blocks or for headless projects, you can only call this method directly when authenticated as a Wix app or Wix user identity. When authenticated as a different identity, you can call this method using elevation.
  • Elevation permits users to call methods they typically cannot access. Therefore, you should only use it intentionally and securely.
Permissions
Manage Badges
Learn more about app permissions.
Method Declaration
Copy
function updateBadgesDisplayOrder(
  badgeIds: Array<string>,
): Promise<UpdateBadgesDisplayOrderResponse>;
Method Parameters
badgeIdsArray<string>Required

Ordered badge IDs.

Returns
Return Type:Promise<UpdateBadgesDisplayOrderResponse>
JavaScript
import { badges } from "@wix/members"; /* Sample badgeIds value: * [ * '215be5d9-4b32-4861-9eb5-2152930dd0b4', * 'aedd9a3d-1efa-45ce-85d6-df09a167e37e', * 'e80fed60-687e-4b91-a24c-252c4b32227b' * ] */ export async function myUpdateBadgesDisplayOrderFunction(badgeIds) { try { const updatedBadgeDisplay = await badges.updateBadgesDisplayOrder(badgeIds); console.log("Updated badge display order: ", updatedBadgeDisplay); return updatedBadgeDisplay; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "badges": [ * { * "_createdDate": "2024-01-18T10:27:14.878Z", * "_id": "215be5d9-4b32-4861-9eb5-2152930dd0b4", * "_updatedDate": "2024-01-18T14:50:36.174Z", * "backgroundColor": "#42A5F5", * "description": "Outstanding Contributor Badge", * "icon": "https://example.com/custom-badge-icon.svg", * "permissionsEnabled": true, * "slug": "super-contributor", * "textColor": "#FFFF00", * "title": "Super Contributor" * }, * { * "_createdDate": "2024-01-18T13:53:11.659Z", * "_id": "aedd9a3d-1efa-45ce-85d6-df09a167e37e", * "_updatedDate": "2024-01-18T13:53:11.659Z", * "backgroundColor": "#796EFF", * "description": "Completed challenging tasks and achieved milestones.", * "icon": "https://static.wixstatic.com/shapes/11062b_30b982c4ceb141d884fa15ecfb07d26c.svg", * "permissionsEnabled": false, * "slug": "achievement-unlocked", * "textColor": "#FFFFFF", * "title": "Achievement Unlocked" * }, * { * "_createdDate": "2024-01-18T13:53:37.067Z", * "_id": "e80fed60-687e-4b91-a24c-252c4b32227b", * "_updatedDate": "2024-01-18T13:53:37.067Z", * "backgroundColor": "#FF5C79", * "description": "Recognized for outstanding community contributions and leadership.", * "icon": "https://static.wixstatic.com/shapes/cb523e8b3f9b4908b85a4a1c577af32b.svg", * "permissionsEnabled": false, * "slug": "community-hero", * "textColor": "#FFFFFF", * "title": "Community Hero" * } * ] * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?