• Resolved tiicaa

    (@tiicaa)


    recently received the following error:

    Fatal error: Uncaught Error: Call to undefined function sensei_get_prev_next_lessons() in /home/customer/www/my-site/public_html/learn/wp-content/plugins/sensei-lms/includes/class-sensei-frontend.php:682 Stack trace: #0 /home/customer/www/my-site/public_html/learn/wp-content/plugins/sensei-lms/includes/class-sensei-frontend.php(652): Sensei_Frontend->maybe_redirect_to_next_lesson(6) #1 /home/customer/www/my-site/public_html/learn/wp-includes/class-wp-hook.php(307): Sensei_Frontend->sensei_complete_lesson(Object(WP)) #2 /home/customer/www/my-site/public_html/learn/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #3 /home/customer/www/my-site/public_html/learn/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #4 /home/customer/www/my-site/public_html/learn/wp-includes/class-wp.php(771): do_action_ref_array('wp', Array) #5 /home/customer/www/my-site/public_html/learn/wp-includes/f in /home/customer/www/my-site/public_html/learn/wp-content/plugins/sensei-lms/includes/class-sensei-frontend.php on line 682

    This error appears every time the student tries to complete a class to move on to the next one.

    the current version of my plugin is Version 4.3.0

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi there,

    Thanks for reaching out. Can you give us some more details about the issue to help us understand and debug it?

    – Did the issue start happening after a plugin or theme update? If yes which plugin or theme did you update?

    – Does the issue happen if only Sensei LMS plugin is active?

    It’s possible that there might be a conflict with one of your current plugins or your theme.

    Try disabling all of your plugins except Sensei LMS (and extensions). Then try testing again to see if the issue persists. If that resolves your issue, you can find what was causing it by enabling each plugin one by one while continuing to test.

    If that doesn’t help, you can also try switching to the Twenty Twenty theme via Appearance > Themes, and test again. If the issue is resolved then you know it’s a problem with the theme, and you’ll need to contact the theme author for further assistance.

    Let us know how it goes.

    Thread Starter tiicaa

    (@tiicaa)

    @gaurav984

    Before opening this support I had already checked all these items that you made here. maybe I missed informing you about it.
    Well, I have my site with only the Sensei LMS plugin active and I changed my theme from DIVI to Twenty Twenty.
    but I get the same error from the frontend file.
    I did a test by commenting out the line according to the error:

    private function maybe_redirect_to_next_lesson( $lesson_id = 0 ) {
    		if ( 0 >= $lesson_id ) {
    			return;
    		}
    
    		$nav_links    = sensei_get_prev_next_lessons( $lesson_id );
    		$redirect_url = false;
    
    		if ( isset( $nav_links['next'] ) ) {
    			$redirect_url = $nav_links['next']['url'];
    		}

    after the line 682 is commented out,

    $nav_links = sensei_get_prev_next_lessons( $lesson_id );

    the error no longer appears and apparently the student is able to complete the course to generate the certificate. I would be able to solve my temporary problem this way, the problem is that the task does not “pass automatically” to the next lesson, the user completes the lesson but he remains with it on the screen, having to manually jump to the next one. That would be bad thinking about the user experience. Can you tell me what I could change in this private function?

    • This reply was modified 2 years, 7 months ago by tiicaa.
    Thread Starter tiicaa

    (@tiicaa)

    @gaurav984

    It seems that only downgrade can solve my problem, version 3.15.2, only this one that contains a different forntend sheet can solve my problem. Remembering that I had deactivated my DIVI theme and all plugins just leaving sensei lms, I used as described above the Twenty Twenty theme I could see all the updates of the new LMs but the error in the frontend in the private function maybe_redirect_to_next_lesson seems not to be acceptable. I also tested with the last two versions of WP. The ph is also compatible.

    Plugin Support Deric (a11n)

    (@dericleeyy)

    @tiicaa , I’ve dug into the code and found this:

    The error complains that the sensei_get_prev_next_lessons function is not defined when it is called on line 682:
    $nav_links = sensei_get_prev_next_lessons( $lesson_id );

    However, this function is fully defined in sensei/includes/template-functions.php line 260:

    https://github.com/Automattic/sensei/blob/ebcbc6112654e85db00edb71685cf0fdf7a8aacd/includes/template-functions.php#L260

    Could you check if your template functions file mirrors what you see on Github?

    Plugin Support Jay

    (@bluejay77)

    Hi @tiicaa,

    Were you able to resolve the issue?

    For now, since it has been more than one week since we have heard from you, I’m marking this topic as resolved.

    But if you have any further questions or need some more help, you’re welcome to reply here or open another thread.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal error undefined function to follow next lesson’ is closed to new replies.