WordPress.org

Ready to get started?Download WordPress

Forums

Namaste! LMS
[resolved] How to Restrict to Complete Lessons? (8 posts)

  1. sanketzalak
    Member
    Posted 10 months ago #

    Hi, Sorry But I am Again Here....

    I want to Restrict Students to Complete Only 1 Lesson Per Day, Can you help me with some scratch code?

    I have tried as Follows :
    Query : $mydate = $wpdb->get_var( "SELECT completion_date FROM wp_namaste_student_lessons WHERE lesson_id='$prepost'" // 2013-09-30

    $pfx_date = get_the_date( $d ); //Current Date 2013-10-01

    $datetime1 = $mydate;
    $datetime2 = $pfx_date;
    $interval = $datetime1->diff($datetime2);
    echo $interval->format('%R%a days');

    But got error that First Value should be DateTime.

    What to Do Now?

    Thanks

    http://wordpress.org/plugins/namaste-lms/

  2. sanketzalak
    Member
    Posted 4 months ago #

    I want to Restrict Students to Complete Only 1 Lesson Per Day, How?

  3. prasunsen
    Member
    Plugin Author

    Posted 4 months ago #

    You'd better do this:

    $exists = $wpdb->get_var("SELECT id FROM wp_namaste_student_lessons WHERE lesson_id='$prepost' AND completion_date=CURDATE() and student_id='$user_ID'");

    if($exists) - means that the student already has a completed lesson today.

  4. sanketzalak
    Member
    Posted 4 months ago #

    How to Get Previous Lesson Id of Same Course, Out of Multiple Courses? If I tried to Get Previous Post Id it takes Garbage Values Some time.

    I have Logic, On Loading of the Lesson If we check previous lesson completion date and compare with current date we can redirect user or display error message.

    Required Fields/ Values :
    1. Current Date
    2. Previous Lesson Id
    3. Completion Date of Previous Lesson Id which is Required Value of point 2.

  5. prasunsen
    Member
    Plugin Author

    Posted 4 months ago #

    You need to join by wp_post_meta table to find the course ID

  6. sanketzalak
    Member
    Posted 4 months ago #

    There is a Function in to Short Code of Namaste LMS, Called // selects the previous lesson in the course if any. Can we use its query or Mechanism for Getting previous lesson details

    like

    Previous Lesson Completed on which date?
    Previous Lesson Id?

  7. prasunsen
    Member
    Plugin Author

    Posted 4 months ago #

    yes, you can

  8. sanketzalak
    Member
    Posted 4 months ago #

    Done with if($exists).

    My Suggestion : Should Add Per Day Lesson Limitation or Pass Control into this Plugin.
    1. No User / Student is Capable to Complete Course in Shorter Time then it will take.
    2. Limit Less Per Day Lessons into Course will end as Confusing or No Result.
    3. Last - All School & Universities require some 60% Attendance, so this Limiting also Solve attendance problem.

Reply

You must log in to post.

About this Plugin

About this Topic