Closed jsantosi closed 14 hours ago
I managed to locate the function in template_functions.php. However, for some reason, it's not being called in class-sensei-frontend.php. Perhaps it's necessary to check if the function exists using "functions_exists". This should avoid the undefined function call error. See:
`/**
@param int $lesson_id Lesson ID. */ private function maybe_redirect_to_next_lesson( $lesson_id = 0 ) { if ( 0 >= $lesson_id ) { return; }
// Verifica se a função existe antes de chamá-la if ( ! function_exists( 'sensei_get_prev_next_lessons' ) ) { return; }
$nav_links = sensei_get_prev_next_lessons( $lesson_id ); $redirect_url = false;
if ( isset( $nav_links['next'] ) ) { $redirect_url = $nav_links['next']['url']; }
/**
if ( $redirect_url ) { wp_safe_redirect( esc_url_raw( $redirect_url ) ); exit; } } `
Hi @jsantosi !
Tested it on a fresh website with WordPress 6.5.3, Sensei LMS 4.24.0 and Course Theme 1.3.7. No error found.
Do you have other plugins or do you use a custom theme? Could you try to deactivate other plugins one-by-one and check if the issue persists? If the plugin dance didn't help, try to switch the theme to a standard WordPress theme or to the Course theme and check if the issue persists.
Closing as no response from author.
Steps to Reproduce
Expected Behavior I expected that clicking to move to the next lesson would transition without errors.
Actual Behavior When attempting to move to the next lesson, the following error occurs:
Fatal error: Uncaught Error: Call to undefined function sensei_get_prev_next_lessons() in /home/customer/www/../public_html/learn/wp-content/plugins/sensei-lms/includes/class-sensei-frontend.php:736
Additional Context Sensei LMS Version: 4.24.0 WordPress Version: 6.5.3