Automattic / sensei

Sensei LMS - Online Courses, Quizzes, & Learning
https://senseilms.com
GNU General Public License v2.0
545 stars 198 forks source link

Sensei Learning Mode not working in Assembler Theme #7659

Closed tanjoymor closed 3 months ago

tanjoymor commented 3 months ago

Steps to Reproduce

  1. Create a course
  2. Make sure Learning Mode is turned on
  3. Switch to the Assembler theme
  4. View a lesson

What I Expected

To see the lesson content using the Learning Mode design

What Happened Instead

I got a blank page

PHP / WordPress / Sensei LMS version

I tested this on an Atomic site in WordPress.com.

Sensei Version 4.24.1

It also happens on a user's site with the Sensei Pro plugin Version 1.24.0

Browser / OS version

Tested in Chrome Version 127.0.6533.72 MacBook Pro Sonoma 14.5

Screenshot / Video

https://github.com/user-attachments/assets/e98f44bb-bb37-4878-9ed1-e89ad17bf4e3

Context / Source

Turning off Learning Mode will display the lesson content.

Switching themes will display the content using Learning Mode properly.

I haven't tested multiple themes.

I don't know if this is a "Sensei" issue or an "Assembler theme" issue.

tanjoymor commented 3 months ago

I've just tested additional themes.

This is also happening in:

Not happening in:

alaczek commented 3 months ago

I tested and reproduced the issue with the Assembler theme. However, I don't have any insights so far - the output is totally blank, and there are no console errors on the front end (and everything works fine in the editor), so there's not much to go on. Maybe someone with Sensei experience can share some debugging ideas.

image

As a side note, it makes sense that the issue would be present in Bark, since it is based on the Assembler theme, which confirms theory it is indeed a theme issue.

dsas commented 3 months ago

I get a fatal php error, so it looks like a Sensei issue to me. I wonder if:

@Automattic/nexus would you be able to look at this?

[07-Aug-2024 08:02:53 UTC] PHP Fatal error:  Uncaught TypeError: strncmp(): Argument #1 ($string1) must be of type string, array given in /wordpress/plugins/sensei-lms/4.24.1/includes/course-theme/class-sensei-course-theme-styles.php:198
Stack trace:
#0 /wordpress/plugins/sensei-lms/4.24.1/includes/course-theme/class-sensei-course-theme-styles.php(198): strncmp(Array, 'var:', 4)
#1 /wordpress/plugins/sensei-lms/4.24.1/includes/course-theme/class-sensei-course-theme-styles.php(159): Sensei_Course_Theme_Styles::get_property_value(Array)
#2 /wordpress/plugins/sensei-lms/4.24.1/includes/course-theme/class-sensei-course-theme-styles.php(66): Sensei_Course_Theme_Styles::format_css_variables(Array, '-global')
#3 /wordpress/core/6.6.1/wp-includes/class-wp-hook.php(324): Sensei_Course_Theme_Styles::output_global_styles_colors('')
#4 /wordpress/core/6.6.1/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#5 /wordpress/core/6.6.1/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#6 /wordpress/core/6.6.1/wp-includes/general-template.php(3065): do_action('wp_head')
#7 /wordpress/core/6.6.1/wp-includes/template-canvas.php(17): wp_head()
#8 /wordpress/core/6.6.1/wp-includes/template-loader.php(106): include('/wordpress/core...')
#9 /wordpress/core/6.6.1/wp-blog-header.php(19): require_once('/wordpress/core...')
#10 /wordpress/core/6.6.1/index.php(17): require('/wordpress/core...')
#11 {main}
  thrown in /wordpress/plugins/sensei-lms/4.24.1/includes/course-theme/class-sensei-course-theme-styles.php on line 198
Imran92 commented 3 months ago

Hi @dsas and @tanjoymor 👋 I have already published a PR https://github.com/Automattic/sensei/pull/7658 fixing it. It's already been approved and will hopefully be released tomorrow with our new Sensei release. So no worries.

In the meantime, before the release, a way around is to switch to another theme very temporarily. Thanks!

tanjoymor commented 3 months ago

Thank you all so much! The customer is happy to wait a few days for the fix to be released.