Deny accordion item depending of the value of php variable

Hello,
I have a problem since a few days on my accordions.
In fact, I have a php variable $profile, and I want to deny accordion item depending of the value of this php variable .

can someone get the idea?

Thank you for your contribution.

You can try to use onBeforeActive event. For example

dhxAccord.attachEvent(“onBeforeActive”,function(id){
return id!=’<?php echo $dened_item?>’
})

I did this, but in other case, it does not open accordions.

dhxAccord.attachEvent("onBeforeActive",function(id){
				profile='<?php echo $_SESSION['profile']; ?>';
				//alert(profile);
				if((profile =='Utilisateur')&&(profile !='Rh'))
				{
					
					return id!='a4' && id!='a5' && id!='a3' && id!='a2';
				}else if(profile =='Rh')
				{
					return;
				}
				});

Hello,

but in other case, it does not open accordions.

I thought that “deny” meant do not open… Please describe the issue in detail.

I have the following script

dhxAccord.attachEvent("onBeforeActive",function(id){
				profile='<?php echo $_SESSION['profile']; ?>';
				//alert(profile);
				if(profile =='Utilisateur')
				{					
					return id!='a4' && id!='a5' && id!='a3' && id!='a2';
				}else 
				{
					return ;
				}
				});

in this part,

if(profile =='Utilisateur')
{
return id!='a4' && id!='a3' && id!='a2';
}else
{
return ;
}
});

I want to close item a2, a3, a4 and opend a1 and a5, but when I run the script
all item a1, a2, a3, a4 and a5 All items remain closed.
his is what I would like to express.
thank you for your contribution.

Try this:
dhxAccord.attachEvent(“onBeforeActive”,function(id,mode){
return !(mode==“close”&&id==“a1”)&&!(mode==“close”&&id==“a5”)
});