I don’t know why my code doesn’t work. Could you help me ? I have used object template literals to retreive the data for user firstname.
Result:
Code gives an undefined result but I have already defined user and firstName is valid for members private data.
Code:
In the first comment. https://www.wix.com/corvid/forum/main/comment/5f2fea1e11c2e8005924499a
I can’t post my code. It gives such an error, nice!
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
No link appears in my code… It gives this error.
@velogenius Try using a console.log(user.firstName) statement to make sure you have a valid value.
BTW - firstRole.name looks like a url (with name as a top level domain) and that’s probably what’s causing your posting error.
@yisrael-wix firstName is a field from private members data collection.
console.log(user.firstName) // gives undefined
Codes works on page as below.

I’ve fix the code by adding query. I have replaced this code
$w("#text532").text = `Hi ${user.firstName} ...`
by this
if (isLoggedIn) {
wixData.query("Members/PrivateMembersData")
.eq("_id", wixUsers.currentUser.id)
.find()
.then((results) => {
$w("#text532").text = "Hi " + results.items[0].firstName + "! Welcome to your business portal. Keep going on exploring.";
})
}