Wix Members: New wix-members & wix-members-backend APIs

We’ve recently migrated wix-users and wix-users-backend APIs to the new wix-members and wix-members-backend namespaces. This change clarifies the terminology and puts these APIs where you would expect to find them.
We’ve also added some long-awaited new functions-

Moving forward, all related new APIs will be in the new wix-members and wix-members-backend namespaces. Learn more
Feel free to share your feedback!


You guys rock!

the profile system still has a bit of sluggish loading… do you intend to improve this?the profile system still has a bit of sluggish loading… do you intend to improve this?

Recent update: We released wix-members-backend events.
Documentation: https://www.wix.com/velo/reference/wix-members-backend/events

1 Like

I’m seem to run into a little bit of trouble with the new members. getMember functions in the backend. I can’t return the ‘FULL’ fieldsets when I call these functions from a backend event such as wixPaidPlans_onPlanPurchased . I can only get the public info and not the full info, for example to get a client’s e-mail address.

1 Like

@verbaldancing pls try again

Thank you Maksim, that’s great, I can retrieve the full fieldsets for getMember now.

I wonder if you could give clarification on how to set/update custom fields with wix-members backend. There seems to be a difference in method between members . updateMember and authentication . register . In the documentation of ‘updateMember’ the custom fields parameters are an object, in ‘register’ they are not described as objects.

Sure, the trick here is that contacts custom fields are served as a “platform” here, which is being re-used by the members custom fields.

All we need to do is to “connect” contacts custom fields with members, so members can update their custom fields data.

To connect fields, please go to “Contacts” > “Site Members” > “Customize Info”

Then click on “+ Add More Fields”

If you have any custom fields created on contacts - they will be displayed with the “+ Add” button near them. If there are no custom fields on contacts side - click on “+ Add Custom Field” and you’ll create a new custom fields

Let me know if I can help anyhow

1 Like

Thank you for your explanation @maksim-norkin . Can I run something by you to check if I’m using the members backend API in the right way?

I have a membership site with multiple ways for customers to get access to paid content:

  1. They can buy a pricing plans

  2. They can buy a customized product

I have made a backend validation script to check if a customer has access to the paid content when they go to certain pages. Non-paying customers can still access these pages, but they will get less content on them. For (1) I check the contact labels using wix-crm-backend. For (2) I wanted to use extended fields, also through wix-crm-backend. However I seem to get some issues when trying to set the extended fields.

When someone buys the custom product, I use

  • a) the backend authentication . register function if they are not a site member, to give them an account on the site.

  • b) the backend members . updateMember function if they are already a member

I was able to set the necessary extended field with (a) but not with (b) and the two seem to need a different syntax, which I didn’t fully figure out yet.

But now I’m also wondering if I’m actually going about this in the right way. You are mentioning that the extended fields in contacts are a platform for the custom fields in members. They need to be connected in the ‘customize info’ screen of the site members. The custom field will then appear in the member account screen, however I don’t really want customers to be able to set this field themselves, because they needs to purchase the product to get access.

Hey, so you need to use wix-crm-backend and set the custom field in there.
All the members are contacts as well - you’ll be able to control what they do with custom fields of contacts without connecting custom fields to members.

@maksim-norkin thank you for your guidance. I am still running into some trouble implementing the scenario where I register a customer as a site member programmatically. As you mentioned I set the custom field using wix-crm-backend. (the extended fields are contained in the ‘contactInfo’ parameter below).

import { authentication } from 'wix-members-backend';
import { contacts } from 'wix-crm-backend';

export async function registerUser(email, contactInfo) {

    let password = "elkwjer434"
    contactInfo.emails = [{ email }]

    let resolvedContact = await contacts.appendOrCreateContact(contactInfo)
    let userId = resolvedContact.contactId
    let identityType = resolvedContact.identityType
    let isMember = identityType !== "CONTACT"

        password = "***"
        return { status: "already a member", email, identityType, userId, password}

    return authentication.register(email, password)
        .then((result) => {
            let userId = result.member._id
            return { status: "successful", email, password, userId }
        .catch((err) => {
            throw err.toString()

The result of this function is a duplicate contact with the same email - one a site member, and one a non-member. Only the non-member seems to have the extended fields that I want. When I delete the duplicate non-member, and try to run the function again, the member contact still doesn’t get updated with the extended fields.

Is there a wix-members “function” that may be used similar to this:

if ( wixUsers . currentUser . loggedIn ) {some code…}; ???

A boolean test for whether the current user is logged in…
I’ve looked and can’t seem to find any.

1 Like

yes I think you could still do that if you make your function asynchronious. For example

import {currentMember} from 'wix-members';

$w.onReady(async function () {
let member = await currentMember.getMember()
if(member){some code etc.}
if(!member){some other code}

if you want it to be more similar to the wixusers you could make it more compact

if(await currentMember.getMember()){some code etc.}
else{some other code}

Thanks for the reply.
I was looking for the “loggedIn” property that was previously available with the wixUsers . currentUser API.

1 Like

Hi webmaster, if you literally want a variable called loggedIn, why don’t you add the following to the previous code

let member = await currentMember.getMember()
let loggedIn = member ? true : false

We’re working on adding this as a separate function



Any update @maksim-norkin on the seperate function?

1 Like

@maksim-norkin , Has there been any progress made on the ‘loggedin’ function?