LLMS_Person_Handler::update( array $data = array(), string $screen = 'update' )
Perform validations according to $screen and update the user
Contents
Description Description
See also See also
- llms_update_user(): for a classless wrapper for this function
Parameters Parameters
- $data
-
(array) (Optional) array of user data array( 'user_id' => '', 'user_login' => '', 'email_address' => '', 'email_address_confirm' => '', 'current_password' => '', 'password' => '', 'password_confirm' => '', 'first_name' => '', 'last_name' => '', 'llms_billing_address_1' => '', 'llms_billing_address_2' => '', 'llms_billing_city' => '', 'llms_billing_state' => '', 'llms_billing_zip' => '', 'llms_billing_country' => '', 'llms_phone' => '', )
Default value: array()
- $screen
-
(string) (Optional) screen to perform validations for, accepts "account", update" or "checkout"
Default value: 'update'
Return Return
(int|WP_Error)
Source Source
File: includes/class.llms.person.handler.php
public static function update( $data = array(), $screen = 'update' ) { do_action( 'lifterlms_before_user_update', $data, $screen ); // user_id will automatically be the current user if non provided if ( empty( $data['user_id'] ) ) { $data['user_id'] = get_current_user_id(); } // if no user id available, return an error if ( ! $data['user_id'] ) { $e = new WP_Error(); $e->add( 'user_id', __( 'No user ID specified.', 'lifterlms' ), 'missing-user-id' ); return $e; } // validate the fields & allow custom validation to occur $valid = apply_filters( 'lifterlms_user_update_data', self::validate_fields( $data, $screen ), $data, $screen ); // if errors found, return them if ( is_wp_error( $valid ) ) { return apply_filters( 'lifterlms_user_update_errors', $valid, $data, $screen ); } // End if(). else { do_action( 'lifterlms_user_update_after_validation', $data, $screen ); // create the user and update all metadata $person_id = self::insert_data( $data, 'update' ); // return the error object if registration fails if ( is_wp_error( $person_id ) ) { return $person_id; // this is filtered already } do_action( 'lifterlms_user_updated', $person_id, $data, $screen ); return $person_id; } }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: