Memberspace integration question

I’m self-taught in code and hope someone could point me in the right direction.

I’m using Memberspace as a membership platform and want to use their API to pull the logged in member’s data (in this case their name) into a Wix HTML element.

It’s very simple code but when I put it in the HTML element, it doesn’t get the data. I think I’m missing what I need to do to make this work:

Prefilled form code:

My best guess is that I have to define “data-ms-member-info” somewhere in the rest of the code, and if that’s the case, where would that be and how? I would appreciate any input!

You’ll need to ask Memberspace’s support or review their docs as yes this code won’t do much other than render an input field.

If they support iframes (what Wix calls HTML Elements) then whatever the proper code they give you is should work.

As Anthony mentioned, this isn’t really a Wix code question.
That said, you need to follow all of the steps on Memberspace’s website, including the Install Code step up at the top of the page you linked. There’s a script that needs to run in your HTML element that will then look for that special input

Your link - Install Code - MemberSpace API

Thanks for the replies - a few clarifications:

  • I’ve been reviewing the Memberspace API to the best of my ability and hope to make my questions about Wix code!
  • I did put the Install Code under the Wix Dashboard Settings>Custom code>Head per Memberspace instructions (this is for the membership platform in general and it works, not sure if it would need to also be placed somewhere else for this purpose?).
  • The API has functions to pull member data such as MemberSpace.getMemberInfo():

    and I don’t know how to utilize this in Wix code.
  • The API also gives the option to “mark specific input elements (DOM nodes) to be prefilled by the widget” which was the code I provided previously. Am I wrong to think this should work with Wix’s HTML elements?

I tried and Memberspace support isn’t able to help with this type of question. I don’t expect hand-holding or easy answers, but if anyone can point me in a direction to look into, I would really appreciate it. I’ve been wondering if wix-fetch would be the way to go.

Hi anthony,

I just discovered that the div code works when I put it in the custom code panel in the dashboard (but not in the HTML elements).

So now the member data I want is showing on the page but I don’t know how I can make use of the data when submitting a form to a collection. Is there a way to link the custom code with regular Velo code?

Communication between the Custom Element and regular Velo code can be achieved with:

  • this.dispatchEvent() to create an event in the Custom Element that will send data to Velo and on() to handle that event from within Velo
  • setAttribute() to send data from Velo to the Custom Element
1 Like

I was looking to link a Custom Code under Dashboard->Settings->Advanced->Custom Code, with Velo code (not a custom element).

Right now I’m able to show the member data in an element that’s created by the Custom Code Panel with this code:

But I need a way to then link that element with Velo code OR to link the Custom Code to an element I added on the Wix editor rather than it creating its own element (the latter would be via DOM manipulation?). Hope that makes sense.

It is very unlikely that you’d want to enter this custom code here, the spot for it would likely be as an HTML Component/Custom Element on a Page, or Dynamic Page.

Can you elaborate a bit on your reasoning for wanting this code here? Have Custom Elements not worked?

HTML elements didn’t work, but I’m looking deeper into custom elements and I think that’s what I’m looking for. Thank you for the input!

1 Like

Hey ! How did it go, did you get through?

Hi Chris,

Yes, I was able to use a custom element with the Memberspace API and it’s working to my liking!

Thank you for checking in.
Ferda

1 Like