Question:
The page url is correct after a relocation (click on another page) but for some reason the information on the page shows the visitors own information. Therefore I wanna query the current page url and with that get info of the correct member which then hopefully will be displayed.
Product:
Wix Editor
What are you trying to achieve:
A member clicks on another members profile photo on a page and with that he is relocated to that members profile page to view his description and images. The first part works excellent because the url is correct but not the displayed info.
What have you already tried:
Almost everything but nothing has worked.
Thank you very much zeeshanmureed40!
I have written your code in this way at my page but unfortunately it didn´t work so can you find any fault or other problem in this version?
$w.onReady(async function () {
let url = wixLocation.url;
let memberId = url.substr(url.lastIndexOf(‘/’) + 1);
let memberInfo = await getMemberInfo(memberId);
$w(“#age”).text = (memberInfo.age);
$w(“#state”).text = (memberInfo.state);
$w(“#image83”).src = (memberInfo.picture);
$w(“#gender”).text = (memberInfo.gender);
$w(“#country”).text = (memberInfo.country);
$w(“#headnick”).text = memberInfo.nickname;
$w(“#nickname”).text = (memberInfo.nickname);
$w(“#textBox2”).value = (memberInfo.description);
});
async function getMemberInfo(memberId) {
let query = wixData.query(“Members”)
.eq(“_id”, memberId)
.find();
let results = await query;
if (results.items.length > 0) {
return results.items[0];
} else {
console.error(Member with ID ${memberId} not found
);
return null;
}
}
Do you think it can work better if I combine it with a dataset?
After 2 years of trying without any working explanation I seriously think that none of Wix so called experts are capable of solving it. The function I described should be a very simple task for you professionals but none seem to have what it takes. I guess that you know how to do it but you want me to rent one of your specialists.
I would be very thankful if someone want to check out my webpages to see what the fault may be and hopefully also manage to fix it.