[Support request] stack trace when clicking account activation link

Home Forums Support [Support request] stack trace when clicking account activation link

Home Forums Support stack trace when clicking account activation link

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #2036308
    Bret

    All latest WP, GP, and GP Premium bits:

    `
    [02-Dec-2021 19:24:57 UTC] PHP Fatal error: Uncaught Error: Call to undefined function is_checkout() in /var/www/demo/production/wp-content/plugins/gp-premium/woocommerce/functions/functions.php:450
    Stack trace:
    #0 /var/www/demo/production/wp-includes/class-wp-hook.php(303): generatepress_wc_checkout_sidebar_layout(‘no-sidebar’)
    #1 /var/www/demo/production/wp-includes/plugin.php(189): WP_Hook->apply_filters(‘no-sidebar’, Array)
    #2 /var/www/demo/production/wp-content/themes/generatepress/inc/theme-functions.php(62): apply_filters(‘generate_sideba…’, ‘no-sidebar’)
    #3 /var/www/demo/production/wp-content/themes/generatepress/inc/general.php(177): generate_get_layout()
    #4 /var/www/demo/production/wp-includes/class-wp-hook.php(303): generate_smart_content_width(Object(WP))
    #5 /var/www/demo/production/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
    #6 /var/www/demo/production/wp-includes/plugin.php(518): WP_Hook->do_action(Array)
    #7 /var/www/demo/production/wp-includes/class-wp.php(763): do_action_ref_array(‘wp’, Array)
    #8 /var/www/d in /var/www/demo/production/wp-content/plugins/gp-premium/woocommerce/functions/functions.php on line 450
    `

    Just clicked an activation link for a new user, and got this error……

    #2036310
    Bret

    check the activation link below

    #2036459
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    None of the WooCommerce module functions should be firing unless WooCommerce is installed and activated.

    Can you confirm that this site has WooCommerce activated already?

    #2036462
    Bret

    Yup, it’s activated…..

    it is a multisite instance, but yeah its a shop demo site so its definitely activated.

    #2036471
    Tom
    Lead Developer
    Lead Developer

    Hmm, so is_checkout() should be defined.

    Is WooCommerce network activated? What about GP Premium?

    This could explain it: https://core.trac.wordpress.org/ticket/23197

    #2036480
    Bret

    This could explain it.

    Currently neither GP Premium or WooCommerce are network activated but I might have changed the GP Premium config as I flailed about awkwardly trying to fix the problem.

    What is the recommended configuration then? Sorry that’s not clear…..

    #2036543
    Tom
    Lead Developer
    Lead Developer

    I’m more curious than anything at this point – multisite can be very weird.

    What happens if you network activate WooCommerce? Does the error go away when activating GPP?

    #2040285
    Bret

    OK will try a few variations and see if it makes any difference

    #2446414
    Pierre

    Hello,

    I have the same problem here. On a site in production, it’s quite annoying.


    @Tom
    is it possible to add a

    if( function_exists( 'is_checkout' ) )

    in /gp-premium/woocommerce/functions/functions.php:450 ?

    Thanks

    #2447486
    Tom
    Lead Developer
    Lead Developer

    We can absolutely do that, but that would mean adding checks like that to a lot of different areas in our WooCommerce integration.

    Technically, none of that code should fire at all if WooCommerce isn’t activated. Are you using multi-site as well? Is the error happening on a site that has WooCommerce activated?

    #2447534
    Pierre

    Hi Tom,

    It’s a multisite with subdomains installations.

    Site 1 : main.domain.com, GP premium activate, Woocommerce deactivate.

    Site 2 : other.domain.com, GP premium activate, Woocommerce deactivate.

    Site 3 : shop.domain.com, GP premium activate with Woocommerce module, Woocommerce activate.

    The user has created an account on the shop.

    The activation link seems correct, like :
    https://shop.domain.com/wp-activate.php?key=7uj7607e88bf7c88
    But arrives on a fatal PHP error.

    Strange bug. Later I will do more tests.

    #2448596
    Tom
    Lead Developer
    Lead Developer

    Very strange, indeed.

    We’ll make a note to add this check to GPP 2.3.0.

    Can you confirm that adding the check in that one place fixes the issue if you change your file to include it?

    #2452865
    Pierre

    Hi Tom,

    Here are the changes I had to make to avoid a PHP fatal error:

    function generatepress_wc_checkout_sidebar_layout( $layout ) {
      
      if( ! function_exists( 'is_checkout' ) ) {
        return $layout;
      }
    function generatepress_wc_show_sticky_add_to_cart() {
    
      if( ! function_exists( 'wc_get_product' ) ) {
        return;
      } 
    function generatepress_wc_scripts() {
    
      if( ! function_exists( 'is_checkout' ) ) {
        return;
      }
    function generatepress_wc_checkout_footer_widgets( $widgets ) {
    
      if( ! function_exists( 'is_checkout' ) ) {
          return $widgets;
      }

    I think it’s a bug in the WordPress core. I created a plugin that registers a “random_test()” function, and is only activated on the shop site. In another plugin, I have an filter on the WordPress hook “body_class”. In the function called by this filter, I call random_test(). This also causes a PHP fatal error on wp-activate.php. So wp-activate.php does not load the plugins correctly.

    #2510583
    Tom
    Lead Developer
    Lead Developer

    Thanks for that! This has been implemented in GPP 2.3.0.

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.