Page 1 of 1

Detail view only for Admins users

Posted: 2020-04-20 12:56
by fciprian
Hello.
I use this code in footer-extras.php to hide fields in detail view for normal users (and shows only to admin) :

<?
$memberInfo = getMemberInfo();
if($memberInfo['group'] !='Admins'){
?>
<script type='text/javascript'>
document.observe("dom:loaded", function() {
$j('label[for="Drop_down_status"]').parent().hide();
});
</script>
<?
}
?>

Some fields like text, checkboxes are hidden BUT i see that not all fields hides. For example, Drop-down list it is not hidding.
What i miss from the code? i really need to hide some drop-down lists for normal users.

Thank you

Re: Detail view only for Admins users

Posted: 2020-04-20 19:36
by pbottcher
Hi,

you may try

$j('#Drop_down_status').parents('.form-group').hide();

instead of

$j('label[for="Drop_down_status"]').parent().hide();

The lable changes for Drop-downs

Re: Detail view only for Admins users

Posted: 2020-04-20 23:56
by fciprian
Worked like a charm :X

Thank you verry much!

Re: Detail view only for Admins users

Posted: 2020-04-24 13:04
by fciprian
Hello.
One more question please.
For document upload?

Thank you verry much.

Re: Detail view only for Admins users

Posted: 2020-04-24 15:29
by pbottcher
Hi,

try

$j('#file').parents('.form-group').hide()

Where #file is the selector for your upload.

Re: Detail view only for Admins users

Posted: 2020-04-26 09:24
by fciprian
Worked. Thank you!!!