Specific Group of Logged-in Users | Show/Hide Accordion

I am so close, but feel I have something wrong. I want to hide the accordion for all but a select group of users. The user that is currently logged in and viewing the form - not a People Picker field.

StaffOnlyAccordion

I have done this globally, but to narrow the scope, I am not sure what I am missing.

//This shows or hides Staff Accordion based on specific logged-in users

fd.spRendered(function() {
var currentUserLoginName=_spPageContextInfo.userLoginName;
function enableOrDisableAccordionTabs() {

if ('[email protected]' || '[email protected]' || '[email protected]' || '[email protected]' || '[email protected]' || '[email protected]' || 'user$pizza.edu' == currentUserLoginName) {

        // Enable Staff Only Accordion
        fd.container('Accordion2').$children[0].disabled = false;

    } else {
        // Disable Staff Only Accordion
      fd.container('Accordion2').$children[0].disabled = true;

    }
}

// Calling enableOrDisableAccordionTabs on form loading
enableOrDisableAccordionTabs();

});

Hello @shedev,

The syntax inside the condition is incorrect. Please try out the following code:

 fd.spRendered(function() {
    //This shows or hides Staff Accordion based on specific logged-in users

    var currentUserLoginName=_spPageContextInfo.userLoginName;
    var arr = ['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', 'user$pizza.edu'];

    function enableOrDisableAccordionTabs() {

        if (arr.indexOf(currentUserLoginName) >= 0) {

                // Enable Staff Only Accordion
                fd.container('Accordion2').$children[0].disabled = false;

            } else {

                // Disable Staff Only Accordion
              fd.container('Accordion2').$children[0].disabled = true;

            }
    }

    // Calling enableOrDisableAccordionTabs on form loading
    enableOrDisableAccordionTabs();
});