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:
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!
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
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():
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.
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?
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?