LLMS_Admin_User_Custom_Fields::add_errors( $errors, bool $update, obj $user )
Validate custom fields During updates will save data Creation is saved during a different action
Description Description
Parameters Parameters
-
(obj) (Required) &$errors Instance of WP_Error
- $update
-
(bool) (Required) true if updating a profile, false if a new user
- $user
-
(obj) (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(); } // 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 |
---|---|
2.7.0 | Introduced. |