Freemius Integration. How it’s handled by WP STAGING

For using multisites together with the Freemius integration we have added a few mechanisms to make sure that Freemius works as expected on your staging website.

Before that, a website containing Freemius threw some fatal errors after cloning like this:

Fatal error: Uncaught TypeError: Argument 1 passed to Freemius::get_api_user_scope_by_user() must be an instance of FS_User, bool given, called in /home/customer/www/website.com/public_html/test/wp-content/plugins/bulk-image-alt-text-with-yoast/vendor/freemius/includes/class-freemius.php on line 22695 and defined in /home/customer/www/website.com/public_html/test/wp-content/plugins/bulk-image-alt-text-with-yoast/vendor/freemius/includes/class-freemius.php:22709

When the Freemius SDK is running on a network, it stores the shared resources on the network-level tables, and therefore, when the site is replicated into a single site, the SDK still thinks it’s in a network, yet it’s missing the shared resources.

So, to prevent that from happening, WP STAGING deletes the following options from the staging sites options table wpstg[int]_options:

'fs_accounts',
'fs_dbg_accounts',
'fs_active_plugins',
'fs_api_cache',
'fs_dbg_api_cache',
'fs_debug_mode'

This means that Freemius will not be authenticated on the staging site any longer and may act slightly differently to the production site.

You can either ignore that or if you want to test out specific Freemius services you can re-authenticate Freemius again on the staging site. I.e., opt-in or license-activation, depending on the product.

Either way, when you push the staging site to the production site, WP STAGING will preserve your Freemius settings on the production site and the production site will not lose its license activation status.

If you have more questions about this, please get in contact with us or our friends from Freemius.

Updated on July 6, 2021