Detail view only for Admins users

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
fciprian
Veteran Member
Posts: 52
Joined: 2020-04-20 10:51

Detail view only for Admins users

Post by fciprian » 2020-04-20 12:56

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

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: Detail view only for Admins users

Post by pbottcher » 2020-04-20 19:36

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
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

fciprian
Veteran Member
Posts: 52
Joined: 2020-04-20 10:51

Re: Detail view only for Admins users

Post by fciprian » 2020-04-20 23:56

Worked like a charm :X

Thank you verry much!

fciprian
Veteran Member
Posts: 52
Joined: 2020-04-20 10:51

Re: Detail view only for Admins users

Post by fciprian » 2020-04-24 13:04

Hello.
One more question please.
For document upload?

Thank you verry much.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: Detail view only for Admins users

Post by pbottcher » 2020-04-24 15:29

Hi,

try

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

Where #file is the selector for your upload.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

fciprian
Veteran Member
Posts: 52
Joined: 2020-04-20 10:51

Re: Detail view only for Admins users

Post by fciprian » 2020-04-26 09:24

Worked. Thank you!!!

Post Reply