I have a multistep application process, but it isn’t in a multistep form. I have 4 unique pages that need to have information submitted on. Is there a way that once a member has made an account on my site that I get their name automatically attached to everything they submit on those various pages in my content manager?
Yes its possible.
import wixUsers from ‘wix-users’ ;
$w.onReady( function () {
//It will get you the User id
//Note : If user logged in then only it will give you the user’s email id
let currentuser = wixUsers. currentUser;
console. log( “OnReady” +currentuser. id);
currentuser. getEmail()
.then( (email) => {
let userEmail = email; // “user@ something .com”
console .log( "User Mailid = " +userEmail);
} );
});
// The Below Function will Trigger Automatically when user login
//You can Get User’s Id, mail, Role
wixUsers .onLogin( (user) => {
let userId = user .id; // “r5cme-6fem-485j-djre-4844c49”
let isLoggedIn = user. loggedIn; // true
let userRole = user. role; // “Member”
user.getEmail()
.then( (email) => {
let userEmail = email; // “user@ something .com”
} );
} );
You need to remove extra space which is near by dot(.)
Example :
let currentuser = wixUsers. currentUser;
You need to remove a space between wixUsers. and currentUser;
Because of the Below Error;
Your account does not currently allow posting of links. If you need to post a link of your site or relevant Wix content, you can “break” the URL by adding spaces, like this: www.wix . com/corvid
Please find the video.
Am getting error for this Code in CodeSnippet.