Filter Collection List based on Memberstack Email (via API)

I’m looking to filter a collection list based on the email of the user logged in (via memberstack).

  1. I’m using the Memberstack API to obtain the member ID, Name and Email of the user logged in. This is at the site level. SEE the code snippet BELOW
  2. My collection list has email addresses of the user who added the entry
  3. I now am looking to figure out how to filter the collection list with the email of the user logged in. It seems simple since I have both data points already, but it’s proving difficult.
<script>

MemberStack.onReady.then(async function(member) {

  // if member is logged in, get their data
  if(member.loggedIn){
    // get the metadata obj
    const metadata = await member.getMetaData();
    var id = member["id"]
    var name = member["name"]
    var email = member["email"]
    
    //Setting Name in Welcome Dashboard and Across Pages
    $('.member-id').text(id);
    $('.member-name').text(name);
    $('.member-email').text(email);
    
  
  }
});

</script>
1 Like

HI @Homsby :wave: How big is the CMS collection you’re trying to filter? The issue is that Webflow does all it’s filtering server-side and only serves up the filtered results. I’m not a developer, but as far as I can tell you’re going to need to get Webflow to send you ALL of your CMS data when the page loads, and filter from there. There are some obvious downsides to this, of course.

(Thinking out loud) I wonder if the CMS API might come in handy here? I don’t know how it would work, but maybe you can specifically request the data you need with an API cal?

2 Likes

Feels like you know the exa ct solution man :sunglasses: