In Drupal 7 is it please possible to enforce all new users to upload an avatar picture during the registration process? I.e. how to make the user picture field mandatory?

When I try to edit the registration form fields at /admin/config/people/accounts/fields there are no settings for the user picture, I only see it being an account widget:

enter image description here

  • Please switch your site to English when taking screenshots. It'll make it easier for us to understand what's the problem. fields can be set to be required, shouldn't be a problem.
    – Mołot
    Commented Nov 18, 2013 at 15:25
  • @Mołot I have uploaded english screenshot. Please tell me, how to set the avatar field to required, I don't see any settings for this. Commented Nov 21, 2013 at 12:57

4 Answers 4


Sounds like you need the register with picture module

enter image description here

  • Thank you, I hope it works well tih Drupal 7.24 and will migrate the existing user avatars too... Commented Nov 21, 2013 at 14:56
  • No worries. I hope it does what you need. Commented Nov 21, 2013 at 14:58
  • Yep, I didn't know of this module. @AlexanderFarber , please let us know what happened, if it was a good solution. Regards Commented Nov 22, 2013 at 9:20

Can you use hook_form_alter. UPDATE : this hook_form_alter must be put in a custom module, lets say mymodule the location of this module will be sites/all/modules/mymodule.

In order to use dpm(), you need to install the Devel module.

Here you can have a tutorial, explaining the basics for creating a custom module. In your case, this is going to be only .info file and a .module file. The hook_form_alter should look like

* Implements hook_form_alter().
 function mymodule_form_alter(&$form, $form_state, $form_id) {
  drupal_set_message("Form ID is : " . $form_id);

A lot of nice snippets can be borrowed from here. drupal forum . After that you can use dpm ($form, 'form');

And see exactly the construction. Those forms use the Drupal 7 Form API construction mechanism. The idea would be to add '#required' => TRUE to the corresponding image field. I hope this helps in a way.

UPDATE: Do not forget to clear your caches(even twice) after enabling a module. Otherwise, some hooks (but not all) will not be recognized. This problem only caused a lot of frustartion when working with Drupal.

Best regards ! Oleg

  • I have installed the devel module on my Drupal 7.24 website and added the line dpm ($form, 'form'); to the function hook_form_alter in the file modules/system/system.api.php but unfortunately I don't see any additional information in the browser, when registering as a new user? Commented Nov 21, 2013 at 14:01
  • 1
    I will clarify it in the edited answer Commented Nov 21, 2013 at 14:07
  • 1
    IMPORTANT: In the permissions of Devel information, add anonymous user to see debug information. Commented Nov 21, 2013 at 14:21

I think you can add a new image field, called 'avatar' and mark it as required in the field's settings.

  • Yes I could do that (same as I added the field "gender" and "city" and made them mandatory), BUT: that image wouldn't be shown as user pic at the user profile page and in blog/forum comments. That is why I'd better would like to find out, how to to make the REAL avatar mandatory. Commented Nov 21, 2013 at 13:19

user picture field module allow you add an image field to user, and show it on user register form, after user register an account, this module will use the fid that upload by image field as user picture's fid. Usage:

1, Add a image field to user, for example "field_user_avatar"

2,config this field,and make it show on user register form.

3,install this module, navigate to "admin/config/people/user_picture_field", here you can config the "Machine name of source field that used as user picture"

When user register an account, he/she upload an image through image field "field_user_avatar", this image will be used as user's picture(avatar).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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