Ejemplo n.º 1
0
 /**
  * Adds a note to the order.
  *
  * @param $order   Order The order.
  * @param $note    string Note text.
  * @param $private bool Is note private?
  *
  * @return int Note ID.
  */
 public function addNote($order, $note, $private = true)
 {
     $comment = array('comment_post_ID' => $order->getId(), 'comment_author' => __('Jigoshop', 'jigoshop'), 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $note, 'comment_type' => 'order_note', 'comment_agent' => __('Jigoshop', 'jigoshop'), 'comment_parent' => 0, 'comment_date' => $this->wp->getHelpers()->currentTime('mysql'), 'comment_date_gmt' => $this->wp->getHelpers()->currentTime('mysql', true), 'comment_approved' => true);
     $comment = $this->wp->applyFilters('jigoshop\\service\\order\\add_note', $comment, $order, $note, $private);
     $comment_id = $this->wp->wpInsertComment($comment);
     $this->wp->addCommentMeta($comment_id, 'private', $private);
     return $comment_id;
 }