How to update Memberstack 1.0 profile URL script to work with Memberstack 2.0? Answered

Post author
Zack Hakim

any chance you can change this to MS 2.0 code?

 

 

<script>
MemberStack.onReady.then(function(member) {
var url = member["profile-url"]
var els = Array.from(document.querySelectorAll("[profile-url]"))
for (var el of els) {
el.href = url
}
})
</script>

Comments

1 comment

  • Comment author
    Jayess

    Hello Zack! 

    I've used ChatGPT to help us convert. Try this out and see if it works  :) 

    <script>
    window.$memberstackDom.getCurrentMember().then(({ data: member }) => { if (member) { var url = member["profile-url"]; var els = Array.from(document.querySelectorAll("[profile-url]")); for (var el of els) { el.href = url; } } else { // do logged out logic here } });
    </script>

    0

Please sign in to leave a comment.