So I have groups called staff, student and admin.

When editing there profile I only want the admin account to be able to see and edit the users picture field. It doesn't really follow the same rules as other fields that I have added so in the "Manage fields" the user picture option isn't even there.

Can i make it so only admins can see and use this field?

Thanks

Comments

ravibarnwal’s picture

You can alter the for by hook_form_alter();
like this (only example)

<?php
global $user;
if ($form_id == "user_profile_form") {
        if (user_is_logged_in()) {           
                $form['field_printer_name']['#access'] = in_array('administrator', $user->roles);          
        }
    }
?>
SamohtVII’s picture

Perfect. Worked it out thanks mate.