/** * New user registration * * @param array $userData Form data. * @param array $customFields Extra fields from register form. * @return array Created and updated user data */ public function moove_register($userData, $customFields) { $user_id = wp_create_user($userData['username'], $userData['password'], $userData['email']); if (is_wp_error($user_id)) { return $user_id; } $userdata = array('ID' => $user_id, 'first_name' => esc_attr($userData['name']), 'last_name' => esc_attr($userData['surname']), 'display_name' => esc_attr($userData['name'] . ' ' . esc_attr($userData['surname'])), 'user_nicename' => esc_attr($userData['name'] . ' ' . esc_attr($userData['surname'])), 'role' => 'free_registration'); $x = wp_update_user($userdata); if (!is_wp_error($x)) { $maildata = array('username' => esc_attr($userData['name'] . ' ' . esc_attr($userData['surname'])), 'user_email' => esc_attr($userData['email'])); $_mailcontent = Moove_View::load('moove.mail.confirm'); $mailcontent = Moove_User::moove_register_mail_content(array('mail' => $_mailcontent, 'view_data' => $maildata)); wp_mail($userData['email'], 'Welcome to ' . get_option('blogname'), $mailcontent, 'Content-type: text/html' . "\r\n" . ''); do_action('moove_user_normal_registration_complete', $user_id); } return $x; }