How to recreate the user_picture field? On Drupal 8 there is by default a user_picture field for the user's photo. When I started my site several months ago, I deleted this field because I did not use it.



Today I need this field, so I created an image type field.



MY PROBLEM : I installed some modules that use the user's photo, but it can not be found because the user_picture is the default

If I create a user_picture field it automatically adds field_ in front of the machine name.

Is it possible to restore the default field with the correct machine name ?
Instead of importing configuration as suggested previously, you could as an alternative, programmatically re-create the field. Here is some code that does that.

&lt;?php

use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;


// Create the user profile field and instance.
FieldStorageConfig::create([
  'entity_type' =&gt; 'user',
  'field_name' =&gt; 'user_picture',
  'type' =&gt; 'image',
  'translatable' =&gt; '0',
])-&gt;save();
FieldConfig::create([
  'label' =&gt; 'User Picture',
  'description' =&gt; '',
  'field_name' =&gt; 'user_picture',
  'entity_type' =&gt; 'user',
  'bundle' =&gt; 'user',
  'required' =&gt; 0,
])-&gt;save();


Assuming the code above is placed in a file called recreateUserPicture.php that is stored in your docroot, you can run the following Drush command:

drush scr recreateUserPicture.php


Best of luck!

N.B.: An alternative answer (since the importing of configuration from the standard profile has a problem with having the field being available in Views UI).