Пример #1
0
 /**
  * Add customer note via ajax
  */
 function add_customer_note()
 {
     $customer_id = (int) $_POST['customer_id'];
     $note = wp_kses_post(trim(stripslashes($_POST['note'])));
     if ($customer_id > 0) {
         $customer = new WC_CRM_Customer($customer_id);
         $comment_id = $customer->add_note($note);
         echo '<li rel="' . esc_attr($comment_id) . '" class="note"><div class="note_content">';
         echo wpautop(wptexturize($note));
         echo '</div><p class="meta"><a href="#" class="delete_customer_note">' . __('Delete note', 'woocommerce') . '</a></p>';
         echo '</li>';
     }
     // Quit out
     die;
 }