Alterate content on the dynamic profile page based on the login email

Hello everyone!

I have a Dynamic collection of freelancers, each item is a Profile. The information has been collected through the Memberstack and passed to Webflow, so emails are all matching.

Profiles are public and can be seen by anyone, but I want to add an “Update profile” section to the page and I want it to be available ONLY if the logged user opens its own profile page

I tried using this snippet but for some reason, it always goes to the option else :woman_shrugging:

MemberStack.onReady.then(function(member) {

    var profileEmail = document.getElementById("profile-email");
    var updateButton = document.getElementById("update-button");

    // check if member is logged in
    if (member.loggedIn) {
        if (profileEmail.innerHTML === member.email) {
           updateButton.style.display = "inline-block";
        } else {
	           updateButton.style.display = "none";
               }

    }
  })

I have a workaround that kinda solves it for now, but it feels like there should be a better solution. Can’t figure out why it’s not working as I expected

Instead of this…

Try this…

profileEmail.text() ===

nope… did not help :frowning:

text() … its a function :thinking: how I can compare it to the member.email which suppose to return a string

https://www.w3schools.com/jquery/html_text.asp is a place to read up on the .text() function

Do you have a link?

Wait, my bad…you’re not using jQuery here. Try this instead

profileEmail.textContent ===

For some reason it returns “null” on member.email :thinking:

15%20PM

Try this instead:

member["email"]

I tried, same result. It return null :woman_shrugging: … my brain refuse to understand LOL

@belltyler could help, please?

It looks like I can’t pull email and name parameters :scream: Email returns null and Name returns undefined

Edit: For future readers… problem here was resolved :grinning:

1 Like

I’m in need of the same thing. Do you mind posting the solution?

1 Like

@belltyler do you still have access to the solution?