User groups conditional display stopped working

  1. Your project’s read-only link.
    Webflow - Ither App
  2. A link to your published project
    https://www.textither.com/
  3. Details on exactly where to look on your site for the problem you’re describing
    a) When the user logs in, a Manage User button takes them to user page
    b) there is conditional formatting to show the user management interface iframe according to what user group they are a member of:
Conditional Visibility
<script>
    // Initialize window.sa5 if it doesn't exist
    window.sa5 = window.sa5 || [];

    // Push the event listener to the array
    window.sa5.push(['userInfoChanged', (user) => {
        if (user.user_data_loaded && user.user_data_loaded.access_groups) {
            const iframeContainer = document.getElementById('iframeContainer');
            // Ensure to check the correct access group case-sensitive
            if (user.access_groups.includes('bifmc')) {
                // User is in the 'BIFMC' group, display the iframe
                iframeContainer.innerHTML = '<iframe src="bifmc retool link" width="100%" height="800px">';
            }
            if (user.access_groups.includes('psb')) {
                // User is in the 'BIFMC' group, display the iframe
                iframeContainer.innerHTML = "psb retool link" width="100%" height="800px">';
            }
            else {
                // User is not in the 'BIFMC' group, display an access denied message
                iframeContainer.innerHTML = '<p>You do not have access to edit the user group.</p>';
            }
        }
    }]);
</script>

I had this working about 10 days ago, tested it with different accounts and showed different formatting. Then a had my pilot user try it, not having thought anything changed, and it didn’t work for them. I tried a bunch of stuff that didn’t work, then reverted to my initial setup.

Here is my site head code:

Thank you, that was the step I was missing, I appreciate it!

I had to remove the links from the html because it wouldn’t let me post my questions with more than 2 links that’s why the code didn’t make sense :sweat_smile: