Property | Type | Description | |
---|---|---|---|
$action | Themosis\Hook\IHook | ||
$capability | string | The capability in order to save custom data. | |
$fields | array | The user custom fields. | |
$hasNonce | boolean | Globally check if nonce inputs are inserted. | |
$rules | array | Validation rules for custom fields. | |
$sections | array | The user sections. | |
$validator | Themosis\Validation\IValidate | Validator instance. | |
$view | Illuminate\View\View | The user core/container view. |
Method | Description | |
---|---|---|
__construct ( Illuminate\View\View $view, Themosis\Validation\IValidate $validator, Themosis\Hook\IHook $action ) | Build a UserFactory instance. | |
addFields ( array $fields, string $capability = 'edit_users' ) : Themosis\User\IUser | Register custom fields for users. | |
addSections ( array $sections ) : Themosis\User\IUser | Register sections for user custom fields. | |
current ( ) : |
Look at the current user and return an instance. | |
displayFields ( $user ) | Render the user fields. | |
get ( integer $id ) : |
Return a User instance using its ID. | |
hasSections ( ) : boolean | Check if there are any sections defined. | |
make ( string $username, string $password, string $email ) : |
Create a new WordPress user. | |
saveFields ( integer $id, array $oldData = [] ) | Triggered by the 'user_register' && 'profile_update' hooks. | |
validate ( array $rules = [] ) : Themosis\User\IUser | Register validation rules for user custom fields. |
Method | Description | |
---|---|---|
createUser ( integer $id ) : |
Create a new User instance. | |
isUsingSections ( array $fields ) | Check if the defined fields are using the sections defined or not. | |
parseCredentials ( array $credentials ) | Check if given credentials to create a new WordPress user are valid. | |
parseTheFields ( array $fields ) : array | Parse the list of registered fields. Remove the sections if defined. | |
register ( integer $id, array $fields ) | Register custom user meta. | |
setDefaultValue ( WP_User | string $user, array $fields ) : array | Set the default 'value' property for all fields. |
public __construct ( Illuminate\View\View $view, Themosis\Validation\IValidate $validator, Themosis\Hook\IHook $action ) | ||
$view | Illuminate\View\View | The user core view. |
$validator | Themosis\Validation\IValidate | Validator instance. |
$action | Themosis\Hook\IHook |
public addSections ( array $sections ) : Themosis\User\IUser | ||
$sections | array | A list of sections to register. |
return | Themosis\User\IUser |
protected createUser ( integer $id ) : |
||
$id | integer | |
return |
public current ( ) : |
||
return |
public hasSections ( ) : boolean | ||
return | boolean |
protected isUsingSections ( array $fields ) | ||
$fields | array |
protected parseCredentials ( array $credentials ) | ||
$credentials | array |
protected parseTheFields ( array $fields ) : array | ||
$fields | array | The fields. |
return | array | A clean list of fields. |
public saveFields ( integer $id, array $oldData = [] ) | ||
$id | integer | The user ID. |
$oldData | array | Null by default. If user update, contains an array of previous user data. |
protected string $capability | ||
return | string |
protected static bool $hasNonce | ||
return | boolean |
protected array $rules | ||
return | array |
protected IValidate,Themosis\Validation $validator | ||
return | Themosis\Validation\IValidate |