I have a custom signup page to force users to fill in all relevant info for their account (Name, Phone number, nickname, picture).
Currently, the registration works fine however when I try to query for that newly created user I get an error with no message.
I want to update their user member info with the fields they entered in so i can always have the data i need for each member.
Is this not possible?
What code are you actually using for your signup and how are members being approved, it looks like you are using approval by token.
Note that there are three roles within Wix (disregarding the member roles that you can set yourself).
They are: Admin - Member - Visitor
However, looking at your example above, I would simply state that as it returns loggedIn: false and role: “Visitor”, then I can guess that as you are querying the Wix Members app collection of Members/PrivateMembersData, that your code will only return the full data for the user if they are a currently logged in user so the query would return loggedIn: true and role: “Member”.
As for member roles, they can’t be set through code and can only be set by the admin of the website through the Dashboard.
https://support.wix.com/en/article/creating-member-roles-6943237
That makes sense as when they are signing up they are not a member.
I mainly want this to be automatic because its often enough someone will sign up without all their needed info.
Would it be better to have a separate collection used to only hold these fields and set up a job that would update their info each day?
However, if the member has signed up and they are an approved site member and regardless of logged in or not, then you should be able to query the Members/PrivatemembersData collection by querying it, providing you go through the correct filters that the fields allow.
https://support.wix.com/en/article/corvid-wix-members-privatemembersdata-collection-fields
Although, note that the permissions are setup as Site Member Author so it is only the specific site member who can see that info.
If you want to bypass those checks etc, then you will need to look into using Wix Data Options.
https://www.wix.com/corvid/reference/wix-data.html#WixDataOptions
As for a seperate dataset, that is your own choice, however I have used both the Wix Members app and this tutorial below for a members profile on a website and it all works fine, the only thing that I don’t use is the Wix Members Login Bar and so only have the login/logout button from the tutorial.
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area
I don’t use approve by token, I have to use manually approved so that the new member can be checked first with the clients etc.
This works perfectly and closes after registering details before moving user onto the specific page, then both names will be saved in Contacts in the Wix Dashboard and once the site member is manually approved the member details will be added immediately to the ‘members’ database which is from the tutorial linked above in the previous reply.
import wixUsers from 'wix-users';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
$w.onReady(function () {
$w("#registerButton").onClick( (event) => {
let email = $w("#email").value;
let password = $w("#password").value;
let first = $w("#firstName").value;
let last = $w("#lastName").value;
wixUsers.register(email, password, {
contactInfo: {
"firstName": $w('#firstName').value,
"lastName": $w('#lastName').value,
}
} )
.then( (result) => {
let resultStatus = result.status;
wixWindow.lightbox.close();
wixLocation.to("/sign-in-status"); //Change the URL ending to whatever page you want to send the user to after they log in.
} );
} );
});
Finally, just note that the Wix tutorial for member profile page will only show on the first visit to that page by the new site member their email and whatever other info you collected on your signup lightbox.
So in my case they will only see their email address and full name of first and last name, then they have the opportunity to add their own profile image and all other parts that the client wants to have on there.
Then they simply save it and all that info is stored in the members dataset and on next visit to their profile page, it will then show all that they have added themselves and they can add/edit it whenever they wish.
The Wix Members app also has it’s own profile page which you can use, however this is more aimed at the people who use Wix Members app and the Wix Forum and Wix Blog app so that their site community (other logged in site members) can see other users profile pages from the Wix Members app.