AP_Form_Hooks::create_user( array $values, array $args, bool $manual )
Description #
Handle create user request.
Parameters #
- $valuesarray (Required) Form values.
- $argsarray (Required) Form arguments.
- $manualbool (Required) Is this manually submitted.
Source #
File: includes/class-form-hooks.php
public static function create_user( &$values, &$args, $manual ) { $email = $values['email']['value']; $user_id = wp_insert_user( array( 'user_email' => $email, 'user_login' => $email, 'user_pass' => wp_generate_password(), 'display_name' => ! empty( $values['anonymous_name']['value'] ) ? $values['anonymous_name']['value'] : '', ) ); if ( is_wp_error( $user_id ) ) { if ( false === $manual ) { ap_ajax_json( array( 'success' => false, 'snackbar' => array( 'message' => $user_id->get_error_message() ), ) ); } else { return $user_id; } } // Send the notification. wp_new_user_notification( $user_id, null, 'both' ); $args['post_author'] = $user_id; }
Expand full source code Collapse full source code View on GitHub: includes/class-form-hooks.php:1029
Add your comment