In a Header With Categories block > Profile Links section I have a link named “My Profile” with the URL myapp.com/profile
I want this link to dynamically include the logged in user’s record ID from Airtable so that when they click the link, which would look like myapp.com/profile?recordid=rec1234567890
, they’re taken to their profile (myapp.com/profile
contains a list details page).
I know that I can do this with the following script which replaces myapp.com/profile
with myapp.com/profile?recordid=rec1234567890
:
<script>
if (window.logged_in_user) {
const recordid = window.logged_in_user.record_id;
const profileLink = document.querySelector('a[href="https://www.myapp.com/profile"]');
if (profileLink) {
profileLink.href = `https://www.myapp.com/profile?recordid=${recordid}`;
}
}
</script>
What I would like to know is, is there any way to do this without a custom script?
I know that I could purchase the Basic plan, add this script to my Custom Code, and it would work - but I haven’t launched my app yet and am trying to cash flow it. Once I have paid users and monthly recurring revenue to offset the cost of Softr I’ll upgrade, but would like to find a more cost effective solution since running this script is the only thing I haven’t been able to do on the Free plan/find a suitable workaround for.
Hi,
Having a list-details block displaying the users information + a conditional filter in the list-details block saying “recordId” is “loggedin user’s recordId” would work?
The recordId wouldn’t be in the URL but it would only display the loggedin user’s info.
Or is it a public profile page to be shared with other users? In other words, does the recordId absolutely need to appear in the url?
@matthieu_chateau it’s a public profile page.
The goal is that when a logged in user clicks My Profile that they see their profile. Otherwise, they’re clicking on the profile link of another user that was shared somewhere (like in a Facebook Group) and will see that profile (because the record ID is in the URL).
The list details block + list block is how I currently have it setup. Works great except for the logged in user being able to view their own profile.
I attempted to do a work around where I have two list details blocks - one for the logged in user to view their profile and the other to view any profile that isn’t the logged in user - but when selecting conditional filters for the list blocks Softr is only showing one of the two list details to filter on, probably because both list details blocks are from the same table in Airtable.
It’s not a deal breaker when clicking “My Profile” for the record ID to not be in the URL so long as the currently logged in user is taken to their public profile.
Based on my current setup, it just seemed like that was the only way to accomplish the desired outcome.
There is a block farther down their profile page (only visible to the logged in user) with their profile URL for sharing.
I’m currently trying to work this out too, have you found a way to do this at the end?
Hi, I’m trying to solve this as well. Is there any workaround?