OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Is there any function in Leandash to mark complete COURSE programmatically

  • Thread starter Thread starter Parthavi Patel
  • Start date Start date
P

Parthavi Patel

Guest
I am working on Leandash Project , Now my requirement is some students have completed the course offline , So I have created a screen for a group leader in which the group leader can select group/user/course and also add date like this ( https://prnt.sc/1bfcq3a ) and can mark complete COURSE.

So my question is how do I mark complete COURSE. programmatically on link click.

here is my code , which is not working

Code:
jQuery(document).on('click', '.course_complete_save', function(event) {
    event.preventDefault();

    var selected_group_id = jQuery('#group_name_select_dropdown').val();
    var selected_user_id = jQuery('#user_name_select_dropdown').val();
    var selected_course_id = jQuery('#course_name_select_dropdown').val();
    var mark_complete_date = jQuery('#input_date_field').val();

    var params =  {"mark_complete_date":mark_complete_date,"selected_group_id":selected_group_id,"selected_user_id":selected_user_id,"selected_course_id":selected_course_id,action:"mark_complete_course_ajax"}

    jQuery.post(groupcustomisation.ajaxurl,params,function(data){
        if(data){
            jQuery(".mark_complete_success").empty().append("Mark Completed");
        }else{
            jQuery(".mark_complete_success").empty().append("No data Found");
        }

    });
});


<?php 
add_action('wp_ajax_nopriv_mark_complete_course_ajax', 'mark_complete_course_ajax');
add_action('wp_ajax_mark_complete_course_ajax', 'mark_complete_course_ajax');
function mark_complete_course_ajax() {

    $selected_group_id = $_POST['selected_group_id'];
    $selected_user_id = $_POST['selected_user_id'];
    $selected_course_id = $_POST['selected_course_id'];
    $mark_complete_date = $_POST['mark_complete_date'];

    learndash_process_mark_complete( $selected_user_id, $selected_course_id, true, $selected_course_id );
        
    echo "1";
         
    die();
}
<p>I am working on Leandash Project , Now my requirement is some students have completed the course offline , So I have created a screen for a group leader in which the group leader can select group/user/course and also add date like this ( <a href="https://prnt.sc/1bfcq3a" rel="nofollow noreferrer">https://prnt.sc/1bfcq3a</a> ) and can mark complete <strong>COURSE</strong>.</p>
<p>So my question is how do I mark complete <strong>COURSE</strong>. programmatically on link click.</p>
<p>here is my code , which is not working</p>
<pre><code>jQuery(document).on('click', '.course_complete_save', function(event) {
event.preventDefault();

var selected_group_id = jQuery('#group_name_select_dropdown').val();
var selected_user_id = jQuery('#user_name_select_dropdown').val();
var selected_course_id = jQuery('#course_name_select_dropdown').val();
var mark_complete_date = jQuery('#input_date_field').val();

var params = {"mark_complete_date":mark_complete_date,"selected_group_id":selected_group_id,"selected_user_id":selected_user_id,"selected_course_id":selected_course_id,action:"mark_complete_course_ajax"}

jQuery.post(groupcustomisation.ajaxurl,params,function(data){
if(data){
jQuery(".mark_complete_success").empty().append("Mark Completed");
}else{
jQuery(".mark_complete_success").empty().append("No data Found");
}

});
});


<?php
add_action('wp_ajax_nopriv_mark_complete_course_ajax', 'mark_complete_course_ajax');
add_action('wp_ajax_mark_complete_course_ajax', 'mark_complete_course_ajax');
function mark_complete_course_ajax() {

$selected_group_id = $_POST['selected_group_id'];
$selected_user_id = $_POST['selected_user_id'];
$selected_course_id = $_POST['selected_course_id'];
$mark_complete_date = $_POST['mark_complete_date'];

learndash_process_mark_complete( $selected_user_id, $selected_course_id, true, $selected_course_id );

echo "1";

die();
}
</code></pre>
Continue reading...
 

Latest posts

A
Replies
0
Views
1
AgencyAnalytics
A
S
Replies
0
Views
1
Stacker Media
S
C
Replies
0
Views
1
CC.Talent
C
Top