/** * Commit all of the listed changes to the issue */ public function commit_changes() { foreach ($this->changes as $field => $value) { $this->commit_value($field, $value['new_value']); } $post_fields = array(); if (isset($this->changes['title'])) { $post_fields['post_title'] = $this->changes['title']['new_value']; } if (isset($this->changes['description'])) { $post_fields['post_content'] = $this->changes['title']['new_value']; } if (!empty($post_fields)) { $this->issue->save_post($post_fields); } }
private function create_issue($data, BuggyPress_Issue $issue = NULL) { if (!isset($issue)) { $issue = new BuggyPress_Issue(0); } // TODO - security $args = array('post_title' => $data[BuggyPress_Form_Element_IssueTitle::FIELD_NAME], 'post_content' => $data[BuggyPress_Form_Element_IssueDescription::FIELD_NAME], 'post_status' => 'publish'); $issue->save_post($args); $issue->set_project_id((int) $data[BuggyPress_Form_Element_IssueProject::FIELD_NAME]); $issue->set_assignee_id((int) $data[BuggyPress_Form_Element_IssueAssignee::FIELD_NAME]); $issue->set_type((int) $data[BuggyPress_Form_Element_IssueType::FIELD_NAME]); $issue->set_status((int) $data[BuggyPress_Form_Element_IssueStatus::FIELD_NAME]); $issue->set_priority((int) $data[BuggyPress_Form_Element_IssuePriority::FIELD_NAME]); $issue->set_resolution((int) $data[BuggyPress_Form_Element_IssueResolution::FIELD_NAME]); return $issue; }