add('empty_username', __('FEL: Ange ditt användarnamn.')); elseif ( !validate_username( $user_login ) ) { $errors->add('invalid_username', __('FEL: Användaren är ogiltig. Ange ett giltigt användarnamn.')); $user_login = ''; } elseif ( username_exists( $user_login ) ) $errors->add('username_exists', __('FEL: '.$user_email.' Det här användarnamnet är upptaget, välj ett annat användarnamn.')); // Check the e-mail address if ($user_email == '') { $errors->add('empty_email', __('FEL: Ange din epost adress.')); } elseif ( !is_email( $user_email ) ) { $errors->add('invalid_email', __('FEL: Epost adressen är inte korrekt.')); $user_email = ''; } elseif ( email_exists( $user_email ) ) $errors->add('email_exists', __('FEL: '.$user_email.' Den här epost adressen är upptagen, välj en annan epost adress.')); do_action('register_post', $user_login, $user_email, $errors); $errors = apply_filters( 'registration_errors', $errors ); if($errors) { echo "




"; foreach($errors as $errorsObj) { foreach($errorsObj as $key=>$val) { for($i=0;$i".$val[$i].''; } } } echo "


"; } if ( $errors->get_error_code() ) { echo '
Tillbaka till utcheckning-sidan
'; exit; } $user_pass = wp_generate_password(12,false); $user_id = wp_create_user( $user_login, $user_pass, $user_email ); if ( !$user_id ) { $errors->add('registerfail', sprintf(__('FEL: Registreringen kunde inte genomföras. Vänligen kontakta webmaster !'), get_option('admin_email'))); exit; } $user_fname = $_POST['user_fname']; $user_add1 = $_POST['user_add1']; $user_city = $_POST['user_city']; $user_state = $_POST['user_state']; $user_country = $_POST['user_country']; $user_postalcode = $_POST['user_postalcode']; $buser_add1 = $_POST['buser_add1']; $buser_city = $_POST['buser_city']; $buser_state = $_POST['buser_state']; $buser_country = $_POST['buser_country']; $buser_postalcode = $_POST['buser_postalcode']; $user_address_info = array( "user_add1" => $user_add1, "user_city" => $user_city, "user_state" => $user_state, "user_country" => $user_country, "user_postalcode"=> $user_postalcode, "buser_name" => $_POST['user_fname'], "buser_add1" => $buser_add1, "buser_city" => $buser_city, "buser_state" => $buser_state, "buser_country" => $buser_country, "buser_postalcode"=> $buser_postalcode, ); update_usermeta($user_id, 'user_address_info', serialize($user_address_info)); // User Address Information Here $userName = $_POST['user_fname']; $updateUsersql = "update $wpdb->users set user_nicename=\"$userName\", display_name=\"$userName\" where ID=\"$user_id\""; $wpdb->query($updateUsersql); //wp_new_user_notification($user_id, $user_pass); global $General; if ( $user_id && $General->is_send_email_guest()) { //wp_new_user_notification($user_id, $user_pass); ///////REGISTRATION EMAIL START////// global $General; $fromEmail = $General->get_site_emailId(); $fromEmailName = $General->get_site_emailName(); $store_name = get_option('blogname'); $order_info = $General->get_order_detailinfo_tableformat($orderInfoArray,1); $clientdestinationfile = ABSPATH . "wp-content/uploads/notification/emails/registration.txt"; if(!file_exists($clientdestinationfile)) { $client_message = '

Hej [#$user_name#],

Du kan nu logga in på zob.se med följande information:

Användarnamn: [#$user_login#]

Lösenord: [#$user_password#]


Vi hoppas att du hittar vad du söker hos oss. Glad shopping!

[#$store_name#]

'; }else { $client_message = file_get_contents($clientdestinationfile); } $filecontent_arr1 = explode('[SUBJECT-STR]',$client_message); $filecontent_arr2 = explode('[SUBJECT-END]',$filecontent_arr1[1]); $subject = $filecontent_arr2[0]; if($subject == '') { $subject = "Registration Email"; } $client_message = $filecontent_arr2[1]; $store_login = get_option('siteurl').'/?page=login'; /////////////customer email////////////// $search_array = array('[#$user_name#]','[#$user_login#]','[#$user_password#]','[#$store_name#]','[#$store_login_url#]'); $replace_array = array($_POST['user_fname'],$user_login,$user_pass,$store_name,$store_login); $client_message = str_replace($search_array,$replace_array,$client_message); $General->sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To clidne email //////REGISTRATION EMAIL END//////// } $userInfoArray = array(); $userInfoArray['ID'] = $user_id; $userInfoArray['display_name'] = $user_fname; $userInfoArray['user_nicename'] = $user_fname; $userInfoArray['user_email'] = $user_email; $userInfoArray['user_id'] = $user_id; $userInfo = $userInfoArray; } ?>