| 1 |
<?php |
| 2 |
namespace FakerPress\Module; |
| 3 |
|
| 4 |
class User extends Base { |
| 5 |
|
| 6 |
public $provider = '\Faker\Provider\WP_User'; |
| 7 |
|
| 8 |
public function save() { |
| 9 |
$user_id = wp_insert_user( $this->params ); |
| 10 |
if ( ! is_null( $this->params['role'] ) ){ |
| 11 |
$user = new \WP_User( $user_id ); |
| 12 |
|
| 13 |
// Here we could add in the future the possibility to set multiple roles at once |
| 14 |
$user->set_role( $this->params['role'] ); |
| 15 |
} |
| 16 |
return $user_id; |
| 17 |
} |
| 18 |
} |