# wp user

Aide:

```bash
$ wp help user
```

```bash
NAME

  wp user

DESCRIPTION

  Manages users, along with their roles, capabilities, and meta.

SYNOPSIS

  wp user <command>

SUBCOMMANDS

  add-cap             Adds a capability to a user.
  add-role            Adds a role for a user.
  check-password      Checks if a user's password is valid or not.
  create              Creates a new user.
  delete              Deletes one or more users from the current site.
  generate            Generates some users.
  get                 Gets details about a user.
  import-csv          Imports users from a CSV file.
  list                Lists users.
  list-caps           Lists all capabilities for a user.
  meta                Adds, updates, deletes, and lists user custom fields.
  remove-cap          Removes a user's capability.
  remove-role         Removes a user's role.
  reset-password      Resets the password for one or more users.
  session             Destroys and lists a user's sessions.
  set-role            Sets the user role.
  spam                Marks one or more users as spam.
  term                Adds, updates, removes, and lists user terms.
  unspam              Removes one or more users from spam.
  update              Updates an existing user.
```

Liste des utilisateurs:

```bash
$ wp user list
+----+-----------+-------------+--------------------+---------------------+--------------+
| ID | user_login| display_name| user_email         | user_registered     | roles         
+----+-----------+-------------+--------------------+---------------------+--------------+
| 2  | bob       | bob         | bob@example.com    | 2018-08-14 15:23:33 | author       |
| 1  | bruno     | bruno       | bruno@clicclac.info| 2017-01-29 08:19:42 | administrator|
+----+-----------+-------------+--------------------+---------------------+--------------+
```

Reset mot-de-passe utilisateur:

```bash
$ wp user update adminuser@example.com --user_pass=new-password-example
```

Créer un nouvel utilisateur:

```bash
$ wp user create bob bob@example.com --role=author
Success: Created user 2.
Password: 7*P%v1he5ogauZw8eyhxXU)d
```

Supprimer l'utilisateur ID2 (et réaffecter ses posts à un autre utilisateur ID1)

```bash
$ wp user delete 2 --reassign=1
Success: Removed user 2 from http://silverbook.local/wordpress.
```

