Support » Plugin: Namaste! LMS » Functionality request with "My Courses"

  • Resolved kskerp

    (@kskerp)


    My students have been giving a lot of feedback and everyone wishes that the “My Courses” section could be listed in the same order that the courses are.

    Students that begin a course, stop, and do not return for a few days are having an extremely hard time remembering where they left off. If the “My Courses” section was listed in the order of the courses, the student would never have any problem locating which they are currently in.

    Now that we have course progression and Course A must be completed prior to Couse B and Course C, is there a possibility that the My Courses page could be listed similarly?

    Please let me know what you think and if this is going to be too much work? I may try to create custom code with the database and the use of an iframe on the home page to show the current course/lesson working on if you think this addition would not be possible.

    – Kevin

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Bob

    (@prasunsen)

    Thanks, we’ll check what can be done

    Thread Starter kskerp

    (@kskerp)

    Thanks, I have been working on this all morning and I got it working.

    I added the following code into the Namaste/controllers/courses.php file:

    @ line 35

    $menu_items = $wpdb->get_results(“SELECT post_title FROM {$wpdb->posts} WHERE menu_order > 0 ORDER BY menu_order ASC;”);

    $y = 0;
    for ( $x = 0; $x < count($menu_items); $x++ ){
    for ( $i = 0; $i < count($courses); $i++ ){

    if ( $menu_items[$x]->post_title == $courses[$i]->post_title ) { $new_courses[$y] = $courses[$i]; $y++; }

    }
    }

    $courses = $new_courses;

    This was the simplest addition I could create. Thanks for all the help and the plugin!!

    Plugin Author Bob

    (@prasunsen)

    I’m afraid this doesn’t work for me. Generally WordPress orders the posts by ID descending. But I don’t think this would be very useful for the student either? Maybe we should order ascending so the oldest course is on top. This still will not reflect any course pre-requisites.

    Thread Starter kskerp

    (@kskerp)

    I do not think that would be very useful either. It would just be the opposite of what it was.

    I think this code only works if you setup the menu order similarly to me. I have added all my courses to a navigation menu which gives them a field called “menu_order” in the posts table. This field has a 0 for all other elements except menu items, so creating an ordered array from it was quite easy.

    I then was comparing the two arrays and re-saving the $courses array into a new array with the correct order that was desired.

    I think this addition may only be accomplished with custom code depending on how people setup their course structure / navigation menu.

    Plugin Author Bob

    (@prasunsen)

    Got it, thanks. I’ll think of some way of ordering courses and lessons

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Functionality request with "My Courses"’ is closed to new replies.