I want to elaborate on this. I have a database where my customers shops, details and products are in there. Whenever they want to edit data, they have to click : Edit Button and that link asks for their mobile number and if its matched from database (from their registration info) it jumps to a certain link. Kindly make it possible. Thanks in advance : )
First, create a backend function that query the database by phone number.
Second, if the query can find items, use wix-location module to redirect user to a certain link.
Third, create a page for members and use backend function to query the database that have the same login email (wixUsers front end module)
Fourth, create a backend function to receive user updates on the input elements so you can use the wix data save() function to update data with the ID
Hi, I would like to know about this code… What is userId means here? Is it the initial part of email?
//---------------------------------------------------------------------------
import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
let user = wixUsers.currentUser;
let userId = user.id ;
let isLoggedIn = user.loggedIn;
$w.onReady(function () {
if (isLoggedIn) {
wixData.query(" #dataset2 ")
.eq(“owner”, userId)
.find()
.then((results) => {
let firstItem = results.items[0]; //see item below
$w(’ #input2 ‘).value = firstItem.businessName;
$w(’ #input3 ‘).value = firstItem.location;
$w(’ #input4 ').value = firstItem.website;
});
}
});
userId is a unique identifier of users on your site.