public function save($post_data = null)
 {
     global $wpdb;
     if (in_array($this->type, array('true_or_false', 'multi_choice', 'single_choice'))) {
         $all_ids = array();
         if (!empty($post_data['answer'])) {
             foreach ($post_data['answer']['text'] as $index => $text) {
                 $answer_id = !empty($post_data['answer']['id'][$index]) ? $post_data['answer']['id'][$index] : 0;
                 $data = array('answer_data' => array('text' => stripslashes($text), 'value' => $post_data['answer']['value'][$index]), 'answer_order' => $index + 1, 'question_id' => $this->id);
                 if ($this->type == 'multi_choice') {
                     $data['answer_data']['is_true'] = is_array($checked = learn_press_get_request("learn_press_question_{$this->id}")) && in_array($post_data['answer']['value'][$index], $checked) ? 'yes' : 'no';
                 } else {
                     $data['answer_data']['is_true'] = $post_data['answer']['value'][$index] == learn_press_get_request("learn_press_question_{$this->id}") ? 'yes' : 'no';
                 }
                 $data = apply_filters('learn_press_question_answer_data', $data, $this);
                 $data['answer_data'] = maybe_serialize($data['answer_data']);
                 if ($answer_id) {
                     $wpdb->update($wpdb->learnpress_question_answers, $data, array('question_answer_id' => $answer_id), array('%s'));
                     $all_ids[] = $post_data['answer']['id'][$index];
                 } else {
                     $wpdb->insert($wpdb->learnpress_question_answers, $data, array('%s', '%d'));
                     $all_ids[] = $wpdb->insert_id;
                 }
             }
         }
         if ($all_ids) {
             $query = $wpdb->prepare("\n\t\t\t\t\tDELETE\n\t\t\t\t\tFROM {$wpdb->learnpress_question_answers}\n\t\t\t\t\tWHERE question_answer_id NOT IN(" . join(',', $all_ids) . ")\n\t\t\t\t\tAND question_id = %d\n\t\t\t\t", $this->id);
         } else {
             $query = $wpdb->prepare("\n\t\t\t\t\tDELETE\n\t\t\t\t\tFROM {$wpdb->learnpress_question_answers}\n\t\t\t\t\tWHERE question_id = %d\n\t\t\t\t", $this->id);
         }
         $wpdb->query($query);
     }
     do_action('learn_press_update_question_answer', $this);
 }
 /**
  * __get function.
  *
  * @param string $key
  *
  * @return mixed
  */
 public function __get($key)
 {
     if (empty($this->{$key})) {
         $value = false;
         switch ($key) {
             case 'current_item':
                 $item_type = !empty($_REQUEST['course-item']) ? $_REQUEST['course-item'] : '';
                 if ($item_type) {
                     $item_id = ($item_id = learn_press_get_request("{$item_type}_id")) && $this->has('item', $item_id) ? $item_id : null;
                     if ($item_id) {
                         $value = $item_type == 'lesson' ? LP_Lesson::get_lesson($item_id) : LP_Quiz::get_quiz($item_id);
                     }
                 }
                 break;
             case 'current_lesson':
                 $lesson_id = ($lesson_id = learn_press_get_request("lesson_id")) && $this->has('item', $lesson_id) ? $lesson_id : null;
                 if ($lesson_id) {
                     $value = LP_Lesson::get_lesson($lesson_id);
                 }
                 break;
             case 'permalink':
                 $value = get_the_permalink($this->id);
                 break;
             default:
                 // default is get course meta key
                 $value = get_post_meta($this->id, '_lp_' . $key, true);
         }
         if (!empty($value)) {
             $this->{$key} = $value;
         }
     }
     return !empty($this->{$key}) ? $this->{$key} : null;
 }
 static function hide_upgrade_notice()
 {
     $ask_again = learn_press_get_request('ask_again');
     $expiration = DAY_IN_SECONDS;
     if ($ask_again == 'no') {
         $expiration = 0;
     }
     set_transient('learn_press_upgrade_courses_ask_again', $ask_again, $expiration);
     learn_press_send_json(array('result' => 'success', 'message' => sprintf('<p>%s</p>', __('Thank for using LearnPress', 'learn_press'))));
 }
Example #4
0
 function save_order($post_id)
 {
     global $action;
     if (wp_is_post_revision($post_id)) {
         return;
     }
     if ($action == 'editpost' && get_post_type($post_id) == 'lp_order') {
         remove_action('save_post', array($this, 'save_order'));
         $order_statuses = learn_press_get_order_statuses();
         $order_statuses = array_keys($order_statuses);
         $status = learn_press_get_request('order-status');
         if (!in_array($status, $order_statuses)) {
             $status = reset($order_statuses);
         }
         $order = learn_press_get_order($post_id);
         $order->update_status($status);
         $user_id = learn_press_get_request('order-customer');
         //$postdata = array( 'post_status' => $status, 'ID' => $post_id );
         ///wp_update_post( $postdata );
         update_post_meta($post_id, '_user_id', $user_id > 0 ? $user_id : 0);
     }
 }
 static function save()
 {
     global $wpdb, $post;
     $questions = learn_press_get_request('learn_press_question');
     if ($all_questions = LP_Quiz::get_quiz($post->ID)->get_questions()) {
         $all_questions = array_keys($all_questions);
     }
     // remove questions if it has removed from $_POST
     if ($all_questions && $questions && ($remove_ids = array_diff($all_questions, array_keys($questions)))) {
         $query = $wpdb->prepare("\n\t\t\t\t\tDELETE\n\t\t\t\t\tFROM {$wpdb->learnpress_quiz_questions}\n\t\t\t\t\tWHERE quiz_id = %d\n\t\t\t\t\tAND question_id IN(" . join(',', $remove_ids) . ")\n\t\t\t\t", $post->ID);
         $wpdb->query($query);
         do_action('learn_press_remove_quiz_questions', $remove_ids, $post->ID);
     }
     if (!$questions) {
         return;
     }
     $titles = learn_press_get_request('learn-press-question-name');
     // update the title of questions and save all data
     foreach ($questions as $id => $data) {
         $question = LP_Question_Factory::get_question($id);
         if (!empty($titles[$id])) {
             $wpdb->update($wpdb->posts, array('post_title' => $titles[$id]), array('ID' => $id), array('%s'));
         }
         $question->save($data);
     }
     // if there are new questions then insert into quiz
     if ($new_ids = array_diff(array_keys($questions), $all_questions)) {
         $values = array();
         foreach ($new_ids as $id) {
             $insert_data = apply_filters('learn_press_quiz_question_insert_data', array('question_id' => $id, 'quiz_id' => $post->ID, 'params' => ''));
             $values[] = $wpdb->prepare("(%d, %d, %s)", $insert_data['quiz_id'], $insert_data['question_id'], $insert_data['param']);
         }
         $query = "\n\t\t\t\t\tINSERT INTO {$wpdb->learnpress_quiz_questions}(`quiz_id`, `question_id`, `params`)\n\t\t\t\t\tVALUES " . join(',', $values) . "\n\t\t\t\t";
         $wpdb->query($query);
         do_action('learn_press_insert_quiz_questions', $new_ids, $post->ID);
     }
 }
Example #6
0
 function review_log($new_status, $old_status, $course_id)
 {
     global $wpdb, $post;
     $required_review = LP()->settings->get('required_review') == 'yes';
     $enable_edit_published = LP()->settings->get('enable_edit_published') == 'yes';
     if (!$required_review || $required_review && $enable_edit_published) {
         return;
     }
     $user = learn_press_get_current_user();
     $message = learn_press_get_request('review_message');
     if (LP()->user->is_instructor() && $required_review && !$enable_edit_published) {
         remove_action('rwmb_course_curriculum_before_save_post', array($this, 'before_save_curriculum'));
         wp_update_post(array('ID' => $post->ID, 'post_status' => 'pending'), array('%d', '%s'));
         add_action('rwmb_course_curriculum_before_save_post', array($this, 'before_save_curriculum'));
     }
     if (!$message && !$user->is_instructor() && get_post_status($post->ID) == 'publish') {
         $message = __('Your course has published', 'learn_press');
     }
     if (apply_filters('learn_press_review_log_message', $message, $post->ID, $user->id)) {
         $query = $wpdb->prepare("\n\t\t\t\t\tINSERT INTO {$wpdb->learnpress_review_logs}(`course_id`, `user_id`, `message`, `date`, `status`, `user_type`)\n\t\t\t\t\tVALUES(%d, %d, %s, %s, %s, %s)\n\t\t\t\t", $post->ID, $user->id, $message, current_time('mysql'), get_post_status($post->ID), $user->is_instructor() ? 'instructor' : 'reviewer');
         $wpdb->query($query);
         do_action('learn_press_update_review_log', $wpdb->insert_id, $post->ID, $user->id);
     }
 }
Example #7
0
 /**
  * @param $join
  *
  * @return string
  */
 function posts_join_paged($join)
 {
     if (!is_admin()) {
         return $join;
     }
     global $pagenow;
     if ($pagenow != 'edit.php') {
         return $join;
     }
     global $post_type;
     if (LP()->question_post_type != $post_type) {
         return $join;
     }
     global $wpdb;
     if ($quiz_id = learn_press_get_request('filter_quiz')) {
         $join .= " INNER JOIN {$wpdb->prefix}learnpress_quiz_questions qq ON qq.question_id = {$wpdb->posts}.ID AND qq.quiz_id = " . $quiz_id;
     }
     return $join;
 }
Example #8
0
 /**
  *  Retake a quiz
  */
 public static function retake_quiz()
 {
     $quiz_id = learn_press_get_request('quiz_id');
     $user_id = learn_press_get_current_user_id();
     $response = array();
     if (!learn_press_user_can_retake_quiz($quiz_id, $user_id)) {
         $response['message'] = __('Sorry! You can not retake this quiz', 'learn_press');
         $response['error'] = true;
     } else {
         //lpr_reset_quiz_answer($quiz_id);
         learn_press_reset_user_quiz($user_id, $quiz_id);
         add_user_meta($user_id, '_lpr_quiz_taken', $quiz_id);
         $response = array('retake' => true, 'redirect' => get_the_permalink($quiz_id));
         do_action('learn_press_user_retake_quiz', $quiz_id, $user_id);
     }
     learn_press_send_json($response);
 }
Example #9
0
 /**
  * Display content for custom column
  *
  * @param string $name
  * @param int    $post_id
  */
 function columns_content($name, $post_id)
 {
     switch ($name) {
         case LP()->course_post_type:
             $courses = learn_press_get_item_courses($post_id);
             if ($courses) {
                 foreach ($courses as $course) {
                     echo '<div><a href="' . esc_url(add_query_arg(array('filter_course' => $course->ID))) . '">' . get_the_title($course->ID) . '</a>';
                     echo '<div class="row-actions">';
                     printf('<a href="%s">%s</a>', admin_url(sprintf('post.php?post=%d&action=edit', $course->ID)), __('Edit', 'learn_press'));
                     echo "&nbsp;|&nbsp;";
                     printf('<a href="%s">%s</a>', get_the_permalink($course->ID), __('View', 'learn_press'));
                     echo "&nbsp;|&nbsp;";
                     if ($course_id = learn_press_get_request('filter_course')) {
                         printf('<a href="%s">%s</a>', remove_query_arg('filter_course'), __('Remove Filter', 'learn_press'));
                     } else {
                         printf('<a href="%s">%s</a>', add_query_arg('filter_course', $course->ID), __('Filter', 'learn_press'));
                     }
                     echo '</div></div>';
                 }
             } else {
                 _e('Not assigned yet', 'learn_press');
             }
             break;
         case 'is_previewable':
             printf('<input type="checkbox" class="learn-press-checkbox learn-press-toggle-lesson-preview" %s value="%s" data-nonce="%s" />', get_post_meta($post_id, '_lp_is_previewable', true) == 'yes' ? ' checked="checked"' : '', $post_id, wp_create_nonce('learn-press-toggle-lesson-preview'));
             break;
         case 'format':
             learn_press_item_meta_format($post_id, __('Standard', 'learn_press'));
     }
 }
 /**
  * Complete lesson
  */
 public static function complete_lesson()
 {
     $nonce = learn_press_get_request('nonce');
     $item_id = learn_press_get_request('id');
     $post = get_post($item_id);
     if (!$post || $post && !wp_verify_nonce($nonce, sprintf('learn-press-complete-%s-%d', $post->post_type, $post->ID))) {
         throw new Exception(__('Error ', 'learn_press'));
     }
     $user = learn_press_get_current_user();
     $response = array('result' => 'error');
     if ($user->complete_lesson($item_id)) {
         ob_start();
         learn_press_display_message(__('Congratulations! You have completed this lesson.', 'learn_press'));
         $response['message'] = ob_get_clean();
         $response['result'] = 'success';
     }
     learn_press_send_json($response);
     die;
     global $post;
     $user_id = get_current_user_id();
     $lesson_id = !empty($_POST['lesson']) ? $_POST['lesson'] : 0;
     if (!$user_id || !$lesson_id) {
         wp_die(__('Access denied!', 'learn_press'));
     }
     $response = array();
     if (learn_press_mark_lesson_complete($lesson_id, $user_id)) {
         $course_id = learn_press_get_course_by_lesson($lesson_id);
         $lessons = learn_press_get_lessons_in_course($course_id);
         $lesson_completed = get_user_meta($user_id, '_lpr_lesson_completed', true);
         $lesson_completed = !empty($lesson_completed[$course_id]) ? $lesson_completed[$course_id] : array();
         if ($lessons) {
             if (false !== ($pos = array_search($lesson_id, $lessons))) {
                 $loop = $pos == count($lessons) - 1 ? 0 : $pos + 1;
                 $infinite = 0;
                 $max = count($lessons);
                 while (in_array($lessons[$loop], $lesson_completed) && $lessons[$loop] != $lesson_id) {
                     $loop++;
                     if ($loop == $max) {
                         $loop = 0;
                     }
                     if ($infinite > $max) {
                         break;
                     }
                 }
                 if ($lessons[$loop] != $lesson_id) {
                     $response['url'] = learn_press_get_course_lesson_permalink($lessons[$loop], $course_id);
                 } else {
                     $response['url'] = learn_press_get_course_lesson_permalink($lesson_id, $course_id);
                 }
             }
         }
     }
     learn_press_send_json($response);
     die;
 }
Example #11
0
 /**
  * __get function.
  *
  * @param string $key
  *
  * @return mixed
  */
 public function __get($key)
 {
     if (isset($this->{$key})) {
         return $this->{$key};
     }
     $value = null;
     switch ($key) {
         case 'current_question':
             if (($question = learn_press_get_request('question')) && is_quiz()) {
                 $value = LP_Question_Factory::get_question($question);
             }
             break;
         case 'questions':
             $value = $this->get_questions();
             break;
         default:
             if (strpos($key, '_lp_') === false) {
                 $key = '_lp_' . $key;
             }
             $value = get_post_meta($this->id, $key, true);
             if ($key == '_lp_duration') {
                 $value = absint($value) * 60;
             }
     }
     if (!empty($value)) {
         $this->{$key} = $value;
     }
     return $value;
 }
/**
 * @param int
 * @param int - since 0.9.5
 *
 * @return bool|int
 */
function learn_press_get_current_question($quiz_id = null, $user_id = 0)
{
    $quiz_id = learn_press_get_quiz_id($quiz_id);
    if (!$user_id) {
        $user_id = get_current_user_id();
    }
    if (!$quiz_id) {
        return false;
    }
    if ($question_id = learn_press_get_request('question')) {
    } else {
        $questions = get_user_meta($user_id, '_lpr_quiz_current_question', true);
        if (!empty($questions) && !empty($questions[$quiz_id])) {
            $question_id = $questions[$quiz_id];
        } else {
            $questions = (array) learn_press_get_user_quiz_questions($quiz_id, $user_id);
            $question_id = reset($questions);
        }
    }
    // ver 0.9.5
    $question_id = apply_filters('learn_press_get_current_question', $question_id, $quiz_id, $user_id);
    return $question_id;
}
 static function save($new, $old, $post_id, $field)
 {
     global $wpdb, $post;
     //LP_Debug::instance()->add( __CLASS__ . '::' . __FUNCTION__ . '(' . join( ',', func_get_args() ) . ')' );
     $questions = learn_press_get_request('learn_press_question');
     /*if( $all_questions = LP_Quiz::get_quiz( $post->ID )->get_questions() ){
     			$all_questions = array_keys( $all_questions );
     		}*/
     // Get all ids of questions stored
     $remove_ids = $wpdb->get_col($wpdb->prepare("\n\t\t\t\t\tSELECT question_id\n\t\t\t\t\tFROM {$wpdb->prefix}learnpress_quiz_questions\n\t\t\t\t\tWHERE quiz_id = %d\n\t\t\t\t", $post->ID));
     // delete all questions stored
     $query = $wpdb->prepare("\n\t\t\t\tDELETE\n\t\t\t\tFROM {$wpdb->prefix}learnpress_quiz_questions\n\t\t\t\tWHERE quiz_id = %d\n\t\t\t", $post->ID, 1);
     $wpdb->query($query);
     learn_press_reset_auto_increment('learnpress_quiz_questions');
     do_action('learn_press_remove_quiz_questions', $remove_ids, $post->ID);
     if (!$questions) {
         return;
     }
     $titles = learn_press_get_request('learn-press-question-name');
     $values = array();
     $order = 1;
     // update the title of questions and save all data
     foreach ($questions as $id => $data) {
         $question = LP_Question_Factory::get_question($id);
         if (!empty($titles[$id])) {
             $wpdb->update($wpdb->posts, array('post_title' => $titles[$id]), array('ID' => $id), array('%s'));
         }
         $question->save($data);
         $insert_data = apply_filters('learn_press_quiz_question_insert_data', array('question_id' => $id, 'quiz_id' => $post->ID, 'params' => ''));
         $values[] = $wpdb->prepare("(%d, %d, %s, %d)", $insert_data['quiz_id'], $insert_data['question_id'], $insert_data['param'], $order++);
     }
     $query = "\n\t\t\t\tINSERT INTO {$wpdb->learnpress_quiz_questions}(`quiz_id`, `question_id`, `params`, `question_order`)\n\t\t\t\tVALUES " . join(',', $values) . "\n\t\t\t";
     $wpdb->query($query);
     do_action('learn_press_insert_quiz_questions', $questions, $post->ID);
 }
Example #14
0
 /**
  * Displaying the content of extra columns
  *
  * @param $name
  * @param $post_id
  */
 function columns_content($name, $post_id)
 {
     switch ($name) {
         case LP()->quiz_post_type:
             $quizzes = learn_press_get_question_quizzes($post_id);
             if ($quizzes) {
                 foreach ($quizzes as $quiz) {
                     echo '<div><a href="' . esc_url(add_query_arg(array('filter_quiz' => $quiz->ID))) . '">' . get_the_title($quiz->ID) . '</a>';
                     echo '<div class="row-actions">';
                     printf('<a href="%s">%s</a>', admin_url(sprintf('post.php?post=%d&action=edit', $quiz->ID)), __('Edit', 'learn_press'));
                     echo "&nbsp;|&nbsp;";
                     printf('<a href="%s">%s</a>', get_the_permalink($quiz->ID), __('View', 'learn_press'));
                     echo "&nbsp;|&nbsp;";
                     if ($quiz_id = learn_press_get_request('filter_quiz')) {
                         printf('<a href="%s">%s</a>', remove_query_arg('filter_quiz'), __('Remove Filter', 'learn_press'));
                     } else {
                         printf('<a href="%s">%s</a>', add_query_arg('filter_quiz', $quiz->ID), __('Filter', 'learn_press'));
                     }
                     echo '</div></div>';
                 }
             } else {
                 _e('Not assigned yet', 'learn_press');
             }
             break;
         case 'type':
             echo learn_press_question_name_from_slug(get_post_meta($post_id, '_lp_type', true));
     }
 }
 public static function convert_question_type()
 {
     if (($from = learn_press_get_request('from')) && ($to = learn_press_get_request('to')) && ($question_id = learn_press_get_request('question_id'))) {
         $data = array();
         parse_str($_POST['data'], $data);
         do_action('learn_press_convert_question_type', $question_id, $from, $to, $data);
         $question = LP_Question_Factory::get_question($question_id, array('type' => $to));
         learn_press_send_json(array('html' => $question->admin_interface(array('echo' => false)), 'icon' => $question->get_icon()));
     } else {
         throw new Exception(__('Convert question type must be specify the id, source and destination type', 'learn_press'));
     }
     die;
 }
/**
 * Redirect to question if user access to a quiz that user has started
 *
 * @param string
 *
 * @return string
 */
function learn_press_redirect_to_question($template)
{
    global $post_type;
    if (is_single() && $post_type == LP()->quiz_post_type) {
        $user = learn_press_get_current_user();
        $quiz_id = get_the_ID();
        $quiz_status = $user->get_quiz_status($quiz_id);
        if ($quiz_status == 'started' && learn_press_get_quiz_time_remaining($user->id, $quiz_id) == 0 && get_post_meta($quiz_id, '_lpr_duration', true)) {
            $user->finish_quiz($quiz_id);
            $quiz_status = 'completed';
        }
        if (learn_press_get_request('question') && $quiz_status == '') {
            wp_redirect(get_the_permalink($quiz_id));
        } elseif ($quiz_status == 'started') {
            if (learn_press_get_request('question')) {
            } else {
                wp_redirect(learn_press_get_user_question_url($quiz_id));
                die;
            }
        } elseif ($quiz_status == 'completed' && learn_press_get_request('question')) {
            wp_redirect(get_the_permalink($quiz_id));
            die;
        }
    }
    return $template;
}
function learn_press_add_ons_content_tab_bundle_activate($current)
{
    $add_ons = learn_press_get_add_ons_from_wp(array('transient_key' => 'lp_ba_add_ons', 'include' => learn_press_get_bundle_activate_add_ons(), 'force' => wp_verify_nonce(learn_press_get_request('check'), 'check_bundle_activate')));
    $time = get_option('_transient_timeout_lp_ba_add_ons');
    $description = __('All add-ons that provide basic features for your LMS site.', 'learn_press');
    $description .= ' ' . sprintf(__('Last checked %s ago'), human_time_diff($time - LP_ADD_ON_TRANSIENT_TIME));
    $description .= ' ' . sprintf(__('<a href="%s">%s</a>'), admin_url('admin.php?page=learn_press_add_ons&tab=bundle_activate&check=' . wp_create_nonce('check_bundle_activate')), __('Check again!', 'learn_press'));
    learn_press_add_on_tab_description($description);
    learn_press_output_add_ons_list($add_ons, $current);
}
Example #18
0
 /**
  * @param $join
  *
  * @return string
  */
 function posts_join_paged($join)
 {
     if (!is_admin()) {
         return $join;
     }
     global $pagenow;
     if ($pagenow != 'edit.php') {
         return $join;
     }
     global $post_type;
     if (LP()->lesson_post_type != $post_type) {
         return $join;
     }
     global $wpdb;
     if ($course_id = learn_press_get_request('filter_course')) {
         $join .= " INNER JOIN {$wpdb->prefix}learnpress_section_items si ON si.item_id = {$wpdb->posts}.ID";
         $join .= " INNER JOIN {$wpdb->prefix}learnpress_sections s ON s.section_id = si.section_id AND s.section_course_id = " . $course_id;
     }
     return $join;
 }
Example #19
0
 private function _review_log()
 {
     global $wpdb, $post;
     $action = '';
     // Course is submitted by instructor
     if (learn_press_get_request('learn_press_submit_course_notice_reviewer') == 'yes') {
         $action = 'learn_press_course_submit_for_reviewer';
     } elseif (learn_press_get_request('learn_press_submit_course_notice_instructor') == 'yes') {
         $action = 'learn_press_course_submit_for_instructor';
     }
     if (!$action) {
         return;
     }
     /*if ( !$required_review || ( $required_review && $enable_edit_published ) ) {
     			return;
     		}*/
     $user = LP()->user;
     $message = learn_press_get_request('review_message');
     if (!$message && !$user->is_instructor() && get_post_status($post->ID) == 'publish') {
         $message = __('Your course has published', 'learn_press');
     }
     if (apply_filters('learn_press_review_log_message', $message, $post->ID, $user->id)) {
         $query = $wpdb->prepare("\n\t\t\t\t\tINSERT INTO {$wpdb->learnpress_review_logs}(`course_id`, `user_id`, `message`, `date`, `status`, `user_type`)\n\t\t\t\t\tVALUES(%d, %d, %s, %s, %s, %s)\n\t\t\t\t", $post->ID, $user->id, $message, current_time('mysql'), get_post_status($post->ID), $user->is_instructor() ? 'instructor' : 'reviewer');
         $wpdb->query($query);
         do_action('learn_press_update_review_log', $wpdb->insert_id, $post->ID, $user->id);
     }
     if ($action == 'learn_press_course_submit_for_instructor') {
         if (get_post_status($post->ID) == 'publish') {
             do_action('learn_press_course_submit_approved', $post->ID, $user);
         } else {
             do_action('learn_press_course_submit_rejected', $post->ID, $user);
         }
     } else {
         do_action($action, $post->ID, $user);
     }
 }