• hangten2016

    (@hangten2016)


    I’m trying to activate advanced shipping by rules and receive the following fatal error:
    Fatal error: Call to undefined function wp_get_current_user() in /home/somagene/staging/1/wp-includes/capabilities.php on line 539

    I’m using PHP 5.6 which is newer and already supports functions.anonymous

    Please advise.

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Open Tools

    (@opentools)

    Dear Hangten2016,
    Sorry to hear about this issue. Unfortunately, our sample installations do not exhibit this problem.

    Do you have the free version installed, too? If so, does it work with the free version?

    If you don’t have the free version installed or if it does not work (meaning that the problem lies either in those parts shared between the free and the advanced version, or the problem is not due to our plugin), then my first attempt would be to comment out the code to load the legacy support (support for old shipping rules from before the switch to shipping zones):

    – open the file wp-content/plugins/woocommerce-advanced-shipping-by-rules/woocommerce-advanced-shipping-by-rules.php from your installation and comment out the last four lines of code (after the comment “// Load the legacy plugin version IF REQUIRED”):

    // Load the legacy plugin version IF REQUIRED!
    /*$legacymethods = get_posts (array ('posts_per_page' => '-1', 'post_type' => 'shipping_rules'));
    if (count($legacymethods)>0) {
    	require_once( plugin_dir_path( __FILE__ ) . 'legacy-woocommerce-advanced-shipping-by-rules.php');
    } */

    My first guess here would be that the call to get_posts (which tries to load all legacy shipping methods to see if we need to load the legacy code in our plugin) tries to access the currently-logged-in user. However, as this code is loaded directly when the plugin is loaded, WooCommerce / WordPress has not yet properly set up the user structures and the corresponding capabilities.

    If this does not work, either, my next attempt would be to comment out the code for the plugin update checker (lines 44 to 58 of the same woocommerce-advanced-shipping-by-rules.php file).

    Does either of these attempts solve your issue?

    Best regards,
    Reinhold

Viewing 1 replies (of 1 total)
  • The topic ‘Fatal Error’ is closed to new replies.