LLMS_Admin_User_Custom_Fields::add_errors( obj $errors, bool $update, WP_User $user )
Validate custom fields
Description Description
During updates will save data, creation is saved during a different action.
Parameters Parameters
- $errors
-
(obj) (Required) Instance of WP_Error, passed by reference.
- $update
-
(bool) (Required)
trueif updating a profile,falseif a new user. - $user
-
(WP_User) (Required) Instance of WP_User for the user being updated.
Return Return
(void)
Source Source
File: includes/admin/class.llms.admin.user.custom.fields.php
public function add_errors( &$errors, $update, $user ) {
$this->get_fields();
$error = $this->validate_fields( $user );
if ( $error ) {
$errors->add( '', $error, '' );
if ( $update ) {
$this->save( $user );
}
// Don't save.
remove_action( 'edit_user_created_user', array( $this, 'save' ) );
return;
}
// If updating, save here since there's no other save specific admin action (that I could find).
if ( $update ) {
$this->save( $user );
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.37.15 | Correctly pass $user to $this->save(). |
| 3.13.0 | Unknown. |
| 2.7.0 | Introduced. |