wp-cli/wp-cli — pull request #896 by leewillis77 (2013-11-27 21:02:58+00:00)
Title: Dont' ignore --role when creating users Edit

Currently the following command results in a user being created with the default site role, rather than the role being passed in.

```
wp user create user email@example.com --role=author
```

The failure happens because the code calls validate_role() and expects a valid role to be returned: https://github.com/leewillis77/wp-cli/blob/master/php/commands/user.php#L196

Currently validate_role returns false where no role is passed in, but doesn't have an explicit return value for the case where a role is passed in, but is invalid, or if it's valid.

This change makes validate_role always return a bool. True for valid, false for invalid. The caller can then decide whether to throw an error.

After this change the initial command works as expected - tests also included.