CoursePress Custom Feature Request

On the student dashboard page (http://www.ge**********ts.com/courses/dashboard/) the button takes to the course details page.

But I want to put the “Continue Learning” button (e.g. shown here: http://www.ge********ts.com/courses/elearning/machine-learning-essentials-for-seismic-interpretation-with-certification/) in the student dashboard page after each course?

  • Nahid
    • Tech Support

    Hey there Laura !

    Hope you are having a great day!

    We have escalated this as a custom request to our Second Level Support team. They’ll be back to us with clues, workarounds, and fixes (if possible) for now in this ticket (or we’ll be updating the ticket as soon as we hear back from them internally). Please note that the response time of the Second Level Support team might be a bit delayed than that of the general Support staff. We really appreciate your patience regarding this.

    Moreover, as this is feature is not available out of the box and is being considered a custom request, we cannot assure a workaround from our end just yet without investigation. This might get flagged as a feature request or you might need to consider custom development if this turns out to be undoable from our end. We really appreciate your consideration regarding this.

    Kind regards,

    Nahid

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi Laura ,

    You can change the link to direct the students to their last seen page by adding this snippet.

    How to install:

    Always make sure to keep a backup of your site before changing / adding custom code.

    1] Navigate to your /wp-content/ directory and create a new one named mu-plugins if it doesn’t exist.

    2] Inside the mu-plugins folder create a file named cp-change-link.php

    3] Edit the file and copy / paste this code snippet inside.

    <?php

    add_filter(
    'coursepress_template_course_list_box',
    function( $template, $course_id, $a ) {

    if ( is_user_logged_in() ) {
    $student_id = get_current_user_id();
    $meta_key = CoursePress_Data_Course::get_last_seen_unit_meta_key( $course_id );
    $last_seen_unit = get_user_meta( $student_id, $meta_key, true );
    if ( is_array( $last_seen_unit ) && isset( $last_seen_unit['unit_id'] ) && isset( $last_seen_unit['page'] ) ) {

    $is_unit = CoursePress_Data_Unit::is_unit( $last_seen_unit['unit_id'] );
    if ( $is_unit ) {
    $continue_learning_link = CoursePress_Data_Unit::get_url( $last_seen_unit['unit_id'], $last_seen_unit['page'] );
    }
    }

    $link = empty( $continue_learning_link ) ? CoursePress_Data_Student::get_last_visited_url( $course_id ) : $continue_learning_link;

    $template = preg_replace( '~(href=")(.*?)(")~', 'href="' . $link . '"', $template );
    return $template;
    }

    return $template;
    },
    15,
    3
    );

    4] Save and close the file.

    5] The final path should look like /wp-content/mu-plugins/cp-change-link.php

    6] Everything should work after that automatically.

    Tell me if you need further help with this !

    Regards,

    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.