Hello, I am trying to get the data from the custom fields from a member in webflow but I just can get it. Here is the custom code that I am using for trying to see the data in the browser console:
EDITED: Sorry I didn’t read that you have to declare the custom fields IN the Account Page, in order to been called by the Attribute. Once you called this custom fileds in the account page, they are getting by the code.
------------------------------- CODE ---------------------------------------
<script type="module">
import { WfuUserInfo, WfuUser } from 'https://cdn.jsdelivr.net/gh/sygnaltech/webflow-util@4.7/src/modules/webflow-membership.js';
import { WfuDataBinder } from 'https://cdn.jsdelivr.net/gh/sygnaltech/webflow-util@4.7/src/modules/webflow-databind.min.js';
$(function() {
var membership = new WfuUserInfo({
userInfoUpdatedCallback: myCallback
}).init();
});
async function myCallback(user) {
// Automatic data-binding using attributes
var dataBinder = new WfuDataBinder({
user: user
}).bind();
if(user.user_data_loaded.email) {
console.log(user.email); // Show the current user's email
}
if(user.user_data_loaded.custom_fields) {
var collaborator = user.data["collaborator"];
var projectid = user.data["projectid"];
console.log(collaborator);
console.log(projectid);
return;
}
}
</script>