public function post(AbstractActivity $activity)
 {
     $managerCourse = new CourseManager();
     $course = $managerCourse->getById($activity->getCourseId());
     $post = array('post_content' => $activity->getShortCode(), 'post_name' => $activity->getName(), 'post_title' => $activity->getName(), 'post_status' => 'publish', 'post_type' => 'post', 'post_author' => $activity->getAuthorId(), 'post_category' => $course->getCategories(), 'post_parent' => $course->getPostId(), 'post_excerpt' => $activity->getDescription() ? $activity->getDescription() : $activity->getName(), 'tags_input' => $activity->getTags());
     $post_id = PostWP::post($post);
     $activity->setPostId($post_id);
     $this->update($activity->getId(), $activity);
     //Attacher l'image si elle existe...
     $this->attacherImageToPost($activity);
     return $post_id;
 }
Esempio n. 2
0
 public function post(Course $course)
 {
     $post = array('post_content' => '', 'post_name' => $course->getName(), 'post_title' => $course->getName(), 'post_status' => 'publish', 'post_type' => 'course', 'post_category' => $course->getCategories(), 'post_excerpt' => $course->getDescription() ? $course->getDescription() : $course->getName());
     $post_id = PostWP::post($post);
     $post = array('ID' => $post_id, 'post_content' => "[studypress_child id=" . $course->getId() . "]");
     PostWP::updatePost($post);
     $course->setPostId($post_id);
     $this->update($course->getId(), $course);
 }