Drupal 8: Crear un usuario programáticamente
06/09/2018 by admin


Cortito y conciso:

use Drupal\user\Entity\User;

$user = User::create();

$new_user = $user->save();

NOTA: A partir de Drupal 8.2 el email es opcional en los usuarios (Siempre que desmarques la opción "Require email verification when a visitor creates an account" en /admin/config/people/accounts )



Add new comment

The content of this field is kept private and will not be shown publicly.

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.