PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | stripe/helpers/FrmStrpLiteConnectApiAdapter.php +16 -2 6.28 → trunk View file →
@@ -24,10 +24,9 @@
24 24 public static function cancel_subscription( $sub_id ) {
25 25 if ( current_user_can( 'administrator' ) ) {
26 26 $customer_id = false;
27 27 } else {
28 - $user_id = get_current_user_id();
29 - $customer = self::get_customer_by_id( $user_id );
28 + $customer = self::get_customer_by_id( get_current_user_id() );
30 29
31 30 if ( ! is_object( $customer ) ) {
32 31 return false;
33 32 }
@@ -35,8 +34,23 @@
35 34 $customer_id = $customer->id;
36 35 }
37 36
38 37 return FrmStrpLiteConnectHelper::cancel_subscription( $sub_id, $customer_id );
38 + }
39 +
40 + /**
41 + * Cancel a subscription without checking that it belongs to the current user.
42 + * Use this when there is no logged in user, like when a webhook event is processed.
43 + * The customer check in self::cancel_subscription would always fail there because the current user ID is 0.
44 + *
45 + * @since 6.35
46 + *
47 + * @param string $sub_id
48 + *
49 + * @return bool
50 + */
51 + public static function cancel_subscription_without_customer_check( $sub_id ) {
52 + return FrmStrpLiteConnectHelper::cancel_subscription( $sub_id );
39 53 }
40 54
41 55 /**
42 56 * @param string $payment_id