Hey, so this code we had to display different content for different users is now broken. I can’t find any documentation on how to fix it with the updated version?
<!-- Sygnal Attr | User Info -->
<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 accessGroup = user.data["group"]; // Get the value from the user object
var elements = document.getElementsByClassName(accessGroup); // Select elements with the same class
for (var i = 0; i < elements.length; i++) {
elements[i].style.display = 'flex'; // Set the display style of the elements to 'flex'
};
var employeeGroup = user.data["employee"]; // Get the value from the user object
var elements = document.getElementsByClassName(employeeGroup); // Select elements with the same class
for (var i = 0; i < elements.length; i++) {
elements[i].style.display = 'flex'; // Set the display style of the elements to 'flex'
};
var dataBinder = new WfuDataBinder({
user: user
}).bind();
}
</script>
I have tried updating the source links to:
https://cdn.jsdelivr.net/gh/sygnaltech/webflow-util@5.2.18/src/modules/webflow-membership.js
https://cdn.jsdelivr.net/gh/sygnaltech/webflow-util@5.2.18/src/modules/webflow-databind.min.js
But this did not fix the issue.
unfortunately it’s not something easily viewable on the front end of the site since certain content should be showing when a specific user is logged in. It is displaying the same content when a user is logged out as when a user is logged in.