Login
Register

VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

Shipping By Rules for WooCommerce

IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.

It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!

×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Fatal Error when trying to activate 10 Nov 2017 16:57 #1

  • realgoodthreads
  • realgoodthreads's Avatar Topic Author
I received this error when trying to activate the plugin
Fatal error: Call to undefined function wp_get_current_user() in /home/somagene/staging/1/wp-includes/capabilities.php on line 539

I contacted my host, and they said the following

I was unable to find what exactly causes the issue with the code of the website and why it is unable to use the plugin. While trying to solve the issue, I used different PHP versions, disabled all rules in php.ini, cleared cache of the website and replaced capabilities.php with a default one, but to no avail.

The only change I made that actually worked was commenting line 539 in capabilities.php:

Code:
//$current_user = wp_get_current_user();


The website is up and running now, but this is not a legit solution, so it will be best to contact WooCommerce developers to get more information if this change would affect plugin's functionality.

Fatal Error when trying to activate 12 Nov 2017 00:08 #2

Dear RealGoodThreads,
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
  • Page:
  • 1