title: Learndash auto complete the topic after assignment approval
body: <p>So I have created an ed-tech website in WordPress and used the Learndash LMS system but I want to do something like if the instructor approves an assignment so it will automatically complete that topic and shows the complete mark, currently after approval of the assignments student need to complete that assignment topic after clicking on &quot;Click and Continue&quot; button.</p>
  <p>I also created a function and also attaching the code here.</p>
  <p>Code starts here:</p>
  <pre><code>add_action('acf/save_post', 'assignment_custom_acf_save', 5);
  
  function assignment_custom_acf_save($post_id) {
  
      if (get_post_type($post_id) == 'sfwd-assignment') {
          $prev_value = get_field('custom_approval_status', $post_id);
          $current_values = $_POST['acf'];        
          $new_status = $current_values['field_628fdf0a73412'];
          $assignment = get_post($post_id);
          $assignment_data = get_post_meta($assignment-&gt;ID);
  
          $student_id = $assignment-&gt;post_author;
          $course_id = $assignment_data['course_id'][0];
          $course_title = get_post_field('post_title', $assignment_data['course_id'][0]);
          $lesson_id = $assignment_data['lesson_id'][0];
          $lesson_title = $assignment_data['lesson_title'][0];
          $teachers_comment = $current_values['field_628fdef373411'];
  
          if ($new_status == 1) {
              delete_post_meta($post_id, 'approval_status');
              learndash_process_mark_incomplete($student_id, $course_id, $lesson_id);
              send_email_after_assignment_rejection($post_id, $teachers_comment);
              
              $rejection_message = 'Thanks for your submission for &lt;b&gt;&lt;a href=&quot;' . get_permalink($lesson_id) . '&quot;&gt;' . $lesson_title . '&lt;/a&gt;&lt;/b&gt; in the ' .
                  '&lt;b&gt;&lt;a href=&quot;' . get_permalink($course_id) . '&quot;&gt;' . $course_title . '&lt;/a&gt;&lt;/b&gt;.&lt;br&gt;&lt;br&gt;' .
                  'Unfortunately, it didn\'t meet the requirements for this assignment.&lt;br&gt;' .
                  (empty($teachers_comment) ? '' : 'This is the comment to your work: &lt;b&gt;' . $teachers_comment . '&lt;/b&gt;') .
                  '&lt;br&gt;&lt;br&gt;Let\'s give it another go!';
  
              send_new_message($student_id, $rejection_message);
          } else if ($new_status == 2) {
              update_post_meta($post_id, 'approval_status', 1);
              learndash_process_mark_complete(I am not sure what should I put here because I am not able to create a topic id);
              send_email_after_assignment_approval($post_id, $teachers_comment);
              
              $approval_message = 'Great job on your assignment! &lt;br&gt;&lt;b&gt;' . $teachers_comment . '&lt;/b&gt;' . (empty($teachers_comment) ? '' : '&lt;br&gt;') .
                  'Your submission for &lt;b&gt;&lt;a href=&quot;' . get_permalink($lesson_id) . '&quot;&gt;' . $lesson_title . '&lt;/a&gt;&lt;/b&gt; in the ' .
                  '&lt;b&gt;&lt;a href=&quot;' . get_permalink($course_id) . '&quot;&gt;' . $course_title . '&lt;/a&gt;&lt;/b&gt; is now approved. &lt;br&gt;Thanks for spending the time to get that in.';
  
              send_new_message($student_id, $approval_message);
              
          }
      }
  }
  </code></pre>