-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warn administrators about "Disable Recurring Payments" when define( 'WP_ENVIRONMENT_TYPE', 'staging' )
is defined
#166
Comments
Could be an improvement, but I'm afraid that |
It is possible that hosting suppliers offer functionalities for setting up staging environments and set |
Sure, therefore I think it is best to add this in addition to URL changes, so we have most scenarios covered. |
We have another customer who is struggling with this:
Internal HelpScout ticket: https://secure.helpscout.net/conversation/2628449520/27366?viewId=1425710#thread-7908733788 Should we auto disable recurring payments if a URL change is detected? WooCommerce Subscriptions marks subscriptions as manual if a duplicate site is detected: I don't know if WPMUDev defines @rvdsteege Do you perhaps have another brilliant idea? |
Maybe the user can add a check in define( 'DISABLE_WP_CRON', true ); define( 'WP_ENVIRONMENT_TYPE', 'staging' );
define( 'DISABLE_WP_CRON', ( 'staging' === WP_ENVIRONMENT_TYPE ) ); Or a must use plugin in the staging environment: \add_action(
'init',
function () {
$is_disabled = (bool) \get_option( 'pronamic_pay_subscriptions_processing_disabled', false );
if ( $is_disabled ) {
return;
}
\update_option( 'pronamic_pay_subscriptions_processing_disabled', true );
}
); |
The multilingual compatibility issues are resolved AFAIK, so auto disabling should be possible (otherwise it could be impossible to use subscriptions on some sites). But maybe we are to strict regarding I still wouldn't rely on the environment type, as I'm not sure if it's in common/proper use.
That it a nice fix too, instead of updating the option it could also only filter the option value. |
Automatically disabling once a URL change is detected might be a good improvement, let's keep that in mind.
Tools that help set up a staging environment should in my opinion define this where possible: define( 'WP_ENVIRONMENT_TYPE', 'staging' );
Source: https://make.wordpress.org/core/2020/07/24/new-wp_get_environment_type-function-in-wordpress-5-5/ Therefore, automatically disabling recurring payments when an environment type change is detected does not seem like a bad idea to me.
Until the must-use plugin accidentally ends up in a production environment and users can’t figure out why recurring payments aren’t working. |
Related to:
Internal HelpScout ticket: https://secure.helpscout.net/conversation/2454026625/26654?viewId=1425710
Maybe also relevant:
The text was updated successfully, but these errors were encountered: