• Hi There,
    After an update not too long ago, there’s been a whole lot of problems with LearnPress…
    It lost mobile styling, so you cannot see the course or lessons and there was no way for students to login. I have fixed this by adding some custom css coding and a few links (login/logut etc.).
    However, there is still one big problem… Logged in students cannot see lesson contents – it just shows “There has been a critical error on this website.” error.

    I have noticed the following error while debugging.

    Fatal error: Uncaught Error: Call to a member function get_id() on bool in /public_html/wp-content/plugins/learnpress/inc/user-item/class-lp-user-item-course.php:775 Stack trace: #0 /public_html/wp-content/plugins/learnpress/inc/user-item/class-lp-user-item-course.php(837): LP_User_Item_Course->get_completed_items('', true, '5') #1 /public_html/wp-content/plugins/learnpress/templates/single-course/loop-section.php(65): LP_User_Item_Course->get_percent_completed_items('', '5') #2 /public_html/wp-content/plugins/learnpress/inc/lp-template-functions.php(921): include('...') #3 /public_html/wp-content/plugins/learnpress/templates/single-course/tabs/curriculum.php(41): learn_press_get_template('single-course/l...', Array) #4 /public_html/wp-content/plugins/learnpress/inc/lp-template-functions.php(921): include('...') #5 /public_html/wp-content/plugins/learnpress/inc/templates/class-lp-template- in /public_html/wp-content/plugins/learnpress/inc/user-item/class-lp-user-item-course.php on line 775
    [26-May-2021 04:24:58 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get_id() on bool in /public_html/wp-content/plugins/learnpress/inc/user-item/class-lp-user-item-course.php:775
    Stack trace:
    #0 /public_html/wp-content/plugins/learnpress/inc/user-item/class-lp-user-item-course.php(837): LP_User_Item_Course->get_completed_items('', true, '5')
    #1 /public_html/wp-content/plugins/learnpress/templates/single-course/loop-section.php(65): LP_User_Item_Course->get_percent_completed_items('', '5')
    #2 /public_html/wp-content/plugins/learnpress/inc/lp-template-functions.php(921): include('...')
    #3 /public_html/wp-content/plugins/learnpress/templates/single-course/tabs/curriculum.php(41): learn_press_get_template('single-course/l...', Array)
    #4 /public_html/wp-content/plugins/learnpress/inc/lp-template-functions.php(921): include('...')
    #5 /public_html/wp-content/plugins/learnpress/inc/templates/class-lp-template- in /public_html/wp-content/plugins/learnpress/inc/user-item/class-lp-user-item-course.php on line 775
    

    This has been tested with all plugins disabled and a default wordpress theme used.

    What could be the issue?

    Thank you 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support brianvu-tp

    (@briantp)

    Hi,

    Please be sure you use the latest version of LearnPress.

    Thread Starter neko_in_space

    (@olgri)

    Yep.
    LearnPress Version 4.0.8
    WP Version 5.7.2
    PHP 7.4.20

    Plugin Support brianvu-tp

    (@briantp)

    Hi,

    Please visit this file /public_html/wp-content/plugins/learnpress/inc/user-item/class-lp-user-item-course.php add this code below $this->read_items() in method get_completed_items :

    
    if ( ! $this->_course ) {
    			return;
    		}
    

    We don’t know why your site has this problem but this code to fix it.

    Thread Starter neko_in_space

    (@olgri)

    This has fixed it. Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fatal error – student cannot see lesson contents’ is closed to new replies.