Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
if ( ! empty($_POST['user_new'][$i]) ) {
$user_id = wp_create_user( $_POST['user_new'][$i], wp_generate_password() );
} else if ( $this->version != '1.0' ) {
$user_data = get_user_by('login', $old_login);
if (empty($user_data) || is_wp_error($user_data)) {
$user_data = array(
'user_login' => $old_login,
'user_pass' => wp_generate_password(),
'user_email' => isset( $this->authors[$old_login]['author_email'] ) ? $this->authors[$old_login]['author_email'] : '',
'display_name' => $this->authors[$old_login]['author_display_name'],
'first_name' => isset( $this->authors[$old_login]['author_first_name'] ) ? $this->authors[$old_login]['author_first_name'] : '',
'last_name' => isset( $this->authors[$old_login]['author_last_name'] ) ? $this->authors[$old_login]['author_last_name'] : '',
);
$user_id = wp_insert_user( $user_data );
} else {
$user_id = $user_data->ID;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.