Show logged in user’s name in the website (updated code)

Insert this in a text field on static block <span id="user-name"></span>
and this to Page Settings>Custom Code>Header field and replace BLOCKID with your block id(name)

<script>
window.addEventListener('block-loaded-BLOCKID', () => {
        if(window.logged_in_user) {
            let helloUser = document.createElement('span').innerTex = "Hello " + window.logged_in_user.softr_user_full_name;
            document.getElementById('user-name').append(helloUser);
        }   
    
});
</script>
2 Likes