Hide Name and Email fields from User Profile block

Updated!

And for the record, the code to add a clear visual on successful information change and on successful password change:

<div id="customModal" class="custom-modal">
        Your information was successfully updated
    </div>

    <div id="customModal2" class="custom-modal">
        Your password was successfully changed
    </div>
    
    <style>
        .custom-modal {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            padding: 20px;
            border: 2px solid green;
            border-radius: 3px;
            background-color: #ffffff;
            color: green;
            font-weight: 700;
            z-index: 9999;
            max-width: 400px;
            text-align: center;
            font-size: 18px;
        }
    </style>

    <script>
        function handleAlert(index) {
            var elem = document.querySelectorAll('button[type=submit]')[index];
            if (!elem) {
                return;
            }

            window.setInterval(function () {
                if (elem.querySelector('.success-icon')) {
                    setTimeout(() => {
                        const modal = document.getElementById(index === 0 ? 'customModal' : 'customModal2');
                        modal.style.display = 'block';

                        setTimeout(() => {
                            modal.style.display = 'none';
                        }, 4000);
                    }, 1000);
                }
            }, 500);
        }

        window.addEventListener('block-loaded-user-accounts1', () => {
            handleAlert(0);

            handleAlert(1);
        });
    </script>
1 Like