Hi everyone. This is my problem. I have created a social media website for work. i have created 4 test profiles so far, Each with a user name and log in and edit profile ETC. That all works perfect. The problem is i have added a button to click that will take you back to your own profile (Dynamic page). when i click the button it always takes me to the same members page no matter what account i am logged in on. is there a way to connect this button to the persons page who is logged in? so who ever is logged in can click the button and it will take them to their own profile page. i have attached some images to help further. Thank you so much to anyone who can help as i have been trying for 2 days now.
You need the field key that you’re using on the dynamic profile page, then add this line of code as the button link.
Since you’re using the atname key to build the profile page URL, you need to use it to build the URL, I’ve coded the link for you but I couldn’t find the button ID that you want to take the user to his profile, just change the button ID (in blue) and you’re good to go.
$w('#button1').link = '/userprofiledata/${atname}';
if you’re on a dynamic page that belongs to its owner, you need to get the gtname value first in order to use it in your link.
let profile = await $w('#dataset1').getCurrentItem();
let atname = profile.atname;
$w('#button1').link = '/userprofiledata/${atname}';
Put the above code inside the page onReady() function, and define it as an async function.
Hope that helped.
Ahmad
Answer improved! Check it out