Updating Metadata, Replacing With 'null'

Hey guys, I am trying to update a user’s metadata when they click on a remove or unfollow button.

I’ve already set up an add/follow button that creates a category item in memberstack’s API.

Screenshot 2020-11-09 140935

I’ve used the code provided in Mackenzie Child’s youtube series. Mark As Complete Code

I’m trying to reverse engineer his code, and so far, this is what I have.

However, when I add this to my page, I do not see the item id updating in memberstack’s metadata.

I’m wondering if this is the right way to update the metadata through memberstack’s API. I’m somewhat new to JavaScript, so hopefully, someone has a better understanding of this. I’m specifically not sure if my if statement that replaces the item id with null is correct.

Does anyone have any solutions?

My guess would be that either the #unfollow-category-item is not triggering that click event or the member.updateMetaData is not getting called due to the if statement.

You could debug this by…

  1. right clicking on the webpage and selecting ‘inspect’
  2. adding a debugger; statement just after the #unfollow-category-item click event.
  3. add another debugger; statement just before the member.updateMetaData statement

See which, if any of those get triggered in the inspector when you click that link.

Thanks for the reply Chris. I was able to figure it out. I ended up scratching the route I was taking after I discovered this instead. John added a bit of code to the bottom of the original snippet that lets me remove the ID entirely from memberstack’s metadata. I modified his code based on my classes and it worked first time.

Now, just need to figure out how to remove multi ref labels in the cms and airtable through zapier. No clue where to begin with that…

1 Like