} ///////////admin email////////// if ($order_status == 'approve') { $subject = get_option('order_approval_client_email_subject'); $admin_message = get_option('order_approval_client_email_content'); } elseif ($order_status == 'shipping') { $subject = get_option('order_shipping_client_email_subject'); $admin_message = get_option('order_shipping_client_email_content'); } elseif ($order_status == 'delivered') { $subject = get_option('order_shipping_client_email_subject'); $admin_message = get_option('order_shipping_client_email_content'); } elseif ($order_status == 'reject') { $subject = get_option('order_rejection_client_email_subject'); $admin_message = get_option('order_rejection_client_email_content'); } $order_info = get_order_detailinfo_tableformat($trans_id); $store_name = $fromEmailName; $search_array = array('[#$user_name#]', '[#$to_name#]', '[#$order_info#]', '[#$store_name#]'); $replace_array = array($orderinfoObj->billing_name, $orderinfoObj->billing_name, $order_info, $store_name); $client_message = apply_filters('order_approved_admin_email_content_filter', str_replace($search_array, $replace_array, $admin_message)); if ($order_status == '1') { templ_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $subject, $client_message, $extra = ''); ///approve/reject email } else { if ($order_status == '3' && $General->is_send_order_reject_email_wpadmin()) { templ_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $subject, $client_message, $extra = ''); ///approve/reject email } } ///AFFILIATE START// if (get_option('is_active_affiliate')) {
/** * Handles registering a new user. * * @param string $user_login User's username for logging in * @param string $user_email User's email address to send password and add * @return int|WP_Error Either user's ID or error on failure. */ function register_new_user($user_login, $user_email) { global $wpdb, $General; $errors = new WP_Error(); $user_login = sanitize_user($user_login); $user_email = apply_filters('user_registration_email', $user_email); // Check the username if ($user_login == '') { $errors->add('empty_username', __('ERROR: Please enter a username.')); } elseif (!validate_username($user_login)) { $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.')); $user_login = ''; } elseif (username_exists($user_login)) { $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.')); } // Check the e-mail address if ($user_email == '') { $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.')); } elseif (!is_email($user_email)) { $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.')); $user_email = ''; } elseif (email_exists($user_email)) { $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.')); } do_action('register_post', $user_login, $user_email, $errors); $errors = apply_filters('registration_errors', $errors); foreach ($errors as $errorsObj) { foreach ($errorsObj as $key => $val) { for ($i = 0; $i < count($val); $i++) { echo "<div class=error_msg>" . $val[$i] . '</div>'; } } } if ($errors->get_error_code()) { return $errors; } $user_pass = wp_generate_password(12, false); $user_id = wp_create_user($user_login, $user_pass, $user_email); $user_add1 = $_POST['user_add1']; $user_add2 = $_POST['user_add2']; $user_city = $_POST['user_city']; $user_state = $_POST['user_state']; $user_country = $_POST['user_country']; $user_postalcode = $_POST['user_postalcode']; $is_affiliate = $_POST['is_affiliate']; $user_address_info = array("user_add1" => $user_add1, "user_add2" => $user_add2, "user_city" => $user_city, "user_state" => $user_state, "user_country" => $user_country, "user_postalcode" => $user_postalcode); update_usermeta($user_id, 'user_address_info', $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); if (!$user_id) { $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email'))); return $errors; } if ($user_id) { if ($is_affiliate) { //$user_role = get_usermeta($user_id,'wp_capabilities'); $user_role['affiliate'] = 1; global $wpdb; $wp_capabilities = $wpdb->prefix . 'capabilities'; update_usermeta($user_id, $wp_capabilities, $user_role); } ////AFFILIATE END/// //wp_new_user_notification($user_id, $user_pass); ///////REGISTRATION EMAIL START////// global $General, $upload_folder_path; $fromEmail = $General->get_site_emailId(); $fromEmailName = $General->get_site_emailName(); $store_name = get_option('blogname'); $order_info = get_order_detailinfo_tableformat($orderInfoArray, 1); $client_message = $filecontent_arr2[1]; $subject = get_option('registration_success_aff_email_subject'); $client_message = get_option('registration_success_aff_email_content'); /////////////customer email////////////// $search_array = array('[#$user_name#]', '[#$user_login#]', '[#$user_password#]', '[#$store_name#]'); $replace_array = array($_POST['user_fname'], $user_login, $user_pass, $store_name); $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//////// } return array($user_id, $user_pass); }
?> <tr> <td style="color:#FF0000;"><?php _e('Order status changed successfuly', 'templatic'); ?> </td> </tr> <?php } ?> <tr> <td><table width="100%" class="order_details"> <tr> <td cellpadding="5" ><?php $orderId = $_REQUEST['oid']; echo get_order_detailinfo_tableformat($orderId); ?> </td> </tr> <tr> <td><form action="<?php echo site_url("/wp-admin/admin.php?page=affiliates&trans_id=" . $_GET['trans_id']); ?> #option_orders" method="post"> <input type="hidden" name="act" value="orderstatus"> <table width="75%" class="widefat post" > <tr> <td width="10%"><strong><?php _e('Order Status'); ?> :</strong></td>