I don't want to display the user picture on the user account page. It is not a field, so I can't simply hide it in display settings. How can I disable it in Drupal 7?


If you don't want it at all in the user registration you can navigate to : admin/config/people/accounts/settings and uncheck "Enable user pictures" on that page.

If you dont want it only on the user profile page you can add this snippet to template.php in your theme folder

function THEME-NAME_preprocess_page(&$variables){
  if (arg(0)=="user" || arg(0)=="users" ){
    unset ($variables['page']['content']['system_main']['user_picture']);

If you want to get rid of it, go to admin/config/people/accounts/settings and uncheck "Enable user pictures" on that page. Notice this will remove the picture form from registration and profile editing forms, as well as comments, nodes and profiles where this used to show up.

If you want to remove it from the profile page only, just preprocess the profile picture out in template.php:

function THEMENAME_preprocess_user_profile(&$variables) {
  • kudos to @silkAdmin for his answer, which I partially used. Sep 13 '11 at 15:06
  • apoologies @barrapunto: I accidentally downvoted his answer, but it is the best :(
    – batigolix
    Sep 24 '14 at 14:30
  • 1
    I don't understand the downvotes on this one. It works exactly as advertised, and is simpler and more to the point than the silkAdmin's answer. Oct 12 '15 at 5:15

If you want to disable the avatar picture in Drupal 7 for any roles in edit case, then you need to change this:

function hook_form_alter(&$form, &$form_state, $form_id) {
  global $user;
  if ($form_id == "user_profile_form") {   
    if(in_array ( {role_id}, array_keys ( $user->roles ) )) {
      $form ['picture']['#access'] = '0';

This is working for my case.

  • This removes the picture from the form. The OP asks removing it from display.
    – batigolix
    Sep 24 '14 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.