Hello,
I tried many combinations during hours,in vain. Can anyone tell me how in the _edit.php module (and perhaps in the _add.php too), I can make some field to become read-only when the group is not Admin.
I obtain some result with this code :
--------------------------
if ($_SESSION["AccessLevel"] == "Admin"){
// is field editable
if(GetEditFormat('OIP') != EDIT_FORMAT_HIDDEN){ echo "\r\n<tr><td class=shade>".Label("OIP")." </td><td>";}
echo BuildEditControl("OIP",$value,GetEditFormat("OIP"),MODE_EDIT);
if(GetEditFormat("OIP")==EDIT_FORMAT_READONLY OR $_SESSION['AccessLevel'] !== 'Admin')
{
if(Format("OIP")!=FORMAT_HTML && Format("OIP")!=FORMAT_FILE_IMAGE && Format("OIP")!=FORMAT_FILE && Format("OIP")!=FORMAT_HYPERLINK && Format("OIP")!=FORMAT_EMAILHYPERLINK && Format("OIP")!=FORMAT_CHECKBOX)
echo htmlspecialchars(GetData($rs,$data,"OIP", Format("OIP")));
else
echo GetData($rs,$data,"OIP", Format("OIP"));
}
echo GetLegendIcon("OIP");
if(GetEditFormat("OIP") != EDIT_FORMAT_HIDDEN)
{echo "</td></tr>";}
}
------------------------
...but the field becomes hidden not read-only AND the value of the hidden field becomes NULL. Pff...
Thanx for any help.
Jean