Ejemplo n.º 1
0
 /**
  * Send email to seller from the seller contact form
  *
  * @param string $seller_email
  * @param string $from_name
  * @param string $from_email
  * @param string $message
  */
 function contact_seller($seller_email, $from_name, $from_email, $message)
 {
     $template = DOKAN_INC_DIR . '/emails/contact-seller.php';
     ob_start();
     include $template;
     $body = ob_get_clean();
     $find = array('%from_name%', '%from_email%', '%user_ip%', '%user_agent%', '%message%', '%site_name%', '%site_url%');
     $replace = array($from_name, $from_email, dokan_get_client_ip(), $this->get_user_agent(), $message, $this->get_from_name(), home_url());
     $subject = sprintf(__('"%s" sent you a message from your "%s" store', 'dokan'), $from_name, $this->get_from_name());
     $body = str_replace($find, $replace, $body);
     $headers = array("Reply-To: {$from_name}<{$from_email}>");
     $this->send($seller_email, $subject, $body, $headers);
 }
Ejemplo n.º 2
0
 /**
  * Insert withdraw info
  *
  * @return void
  */
 function insert_withdraw_info()
 {
     global $current_user, $wpdb;
     $amount = floatval($_POST['witdraw_amount']);
     $method = $_POST['withdraw_method'];
     $data_info = array('user_id' => $current_user->ID, 'amount' => $amount, 'status' => 0, 'method' => $method, 'ip' => dokan_get_client_ip(), 'notes' => '');
     $update = $this->insert_withdraw($data_info);
     Dokan_Email::init()->new_withdraw_request($current_user, $amount, $method);
     wp_redirect(add_query_arg(array('message' => 'request_success'), dokan_get_navigation_url('withdraw')));
 }
Ejemplo n.º 3
0
 function send_email()
 {
     check_ajax_referer('dokan_product_enquiry');
     $posted = $_POST;
     $url = isset($_POST['url']) ? $_POST['url'] : '';
     if (!empty($url)) {
         wp_send_json_error('Boo ya!');
     }
     if (is_user_logged_in()) {
         $sender = wp_get_current_user();
         $from_name = $sender->display_name;
         $from_email = $sender->user_email;
     } else {
         $from_name = trim(strip_tags($posted['author']));
         $from_email = trim(strip_tags($posted['email']));
     }
     $message = esc_attr(trim($posted['enq_message']));
     if ($message == '') {
         wp_send_json_error('oops');
     }
     $product_id = (int) $posted['enquiry_id'];
     $seller_id = (int) $posted['seller_id'];
     $seller = get_user_by('id', $seller_id);
     // no seller found
     if (!$seller || is_wp_error($seller)) {
         $message = sprintf('<div class="alert alert-success">%s</div>', __('Something went wrong!', 'dokan'));
         wp_send_json_error($message);
     }
     // no product found
     $product = get_post($product_id);
     if (!$product) {
         $message = sprintf('<div class="alert alert-success">%s</div>', __('Something went wrong!', 'dokan'));
         wp_send_json_error($message);
     }
     $template = dirname(__FILE__) . '/includes/email.php';
     ob_start();
     include $template;
     $body = ob_get_clean();
     $find = array('%from_name%', '%from_email%', '%user_ip%', '%user_agent%', '%message%', '%site_name%', '%site_url%', '%product_name%', '%product_url%', '%seller_name%');
     $replace = array($from_name, $from_email, dokan_get_client_ip(), $this->get_user_agent(), $message, $this->get_from_name(), home_url(), $product->post_title, get_permalink($product_id), $seller->display_name);
     $subject = sprintf(__('"%s" sent you a message from your "%s" store', 'dokan'), $from_name, $this->get_from_name());
     $body = str_replace($find, $replace, $body);
     $headers = array("Reply-To: {$from_name}<{$from_email}>");
     $this->send($seller->user_email, $subject, $body, $headers);
     // print_r( $_POST );
     $success = sprintf('<div class="alert alert-success">%s</div>', __('Email sent successfully!', 'dokan'));
     wp_send_json_success($success);
 }