The gform_stripe_connect_enabled filter allows disabling Stripe Connect in order to use the legacy Stripe API key connection method.
Usage
add_filter('gform_stripe_connect_enabled', 'your_custom_function'); function your_custom_function($stripe_connect_enabled) { // Your custom code here return $stripe_connect_enabled; }
Parameters
- $stripe_connect_enabled (boolean) – Set to
True
by default on new installations. When set toFalse
, the legacy Stripe setting screen will be shown instead of the recommended Stripe Connect settings screen.
More information
See Gravity Forms Docs: gform_stripe_connect_enabled
Examples
Disable Stripe Connect
Disable Stripe Connect and use the legacy Stripe API key connection method.
add_filter('gform_stripe_connect_enabled', 'disable_stripe_connect'); function disable_stripe_connect($stripe_connect_enabled) { $stripe_connect_enabled = false; return $stripe_connect_enabled; }
Enable Stripe Connect for specific forms
Enable Stripe Connect only for specific forms based on their form IDs.
add_filter('gform_stripe_connect_enabled', 'enable_stripe_connect_for_specific_forms', 10, 2); function enable_stripe_connect_for_specific_forms($stripe_connect_enabled, $form) { $allowed_forms = array(1, 2, 3); // Form IDs for which Stripe Connect should be enabled if (in_array($form['id'], $allowed_forms)) { $stripe_connect_enabled = true; } else { $stripe_connect_enabled = false; } return $stripe_connect_enabled; }
Enable Stripe Connect based on user role
Enable Stripe Connect only for users with a specific role.
add_filter('gform_stripe_connect_enabled', 'enable_stripe_connect_for_user_role'); function enable_stripe_connect_for_user_role($stripe_connect_enabled) { $user = wp_get_current_user(); if (in_array('administrator', $user->roles)) { $stripe_connect_enabled = true; } else { $stripe_connect_enabled = false; } return $stripe_connect_enabled; }
Enable Stripe Connect based on a custom condition
Enable Stripe Connect based on a custom condition, like a specific date or a website setting.
add_filter('gform_stripe_connect_enabled', 'enable_stripe_connect_custom_condition'); function enable_stripe_connect_custom_condition($stripe_connect_enabled) { $current_date = date('Y-m-d'); $start_date = '2023-05-01'; if ($current_date >= $start_date) { $stripe_connect_enabled = true; } else { $stripe_connect_enabled = false; } return $stripe_connect_enabled; }
Toggle Stripe Connect with a custom filter
Use a custom filter to toggle Stripe Connect on or off.
add_filter('gform_stripe_connect_enabled', 'toggle_stripe_connect_with_custom_filter'); function toggle_stripe_connect_with_custom_filter($stripe_connect_enabled) { $custom_filter_value = apply_filters('your_custom_filter', ''); if ($custom_filter_value === 'enable') { $stripe_connect_enabled = true; } else { $stripe_connect_enabled = false; }