From 5e2ba3bd28d4fc352ba633e6c9d32524ea4b4b44 Mon Sep 17 00:00:00 2001 From: i-just Date: Fri, 3 Jan 2025 14:45:44 +0000 Subject: [PATCH 1/3] createUserIdMissing should only be available for cms pro and up --- src/services/Subscriptions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/Subscriptions.php b/src/services/Subscriptions.php index a57621a..e1878d6 100644 --- a/src/services/Subscriptions.php +++ b/src/services/Subscriptions.php @@ -9,6 +9,7 @@ use Craft; use craft\elements\User; +use craft\enums\CmsEdition; use craft\events\ConfigEvent; use craft\helpers\Json; use craft\helpers\ProjectConfig; @@ -154,7 +155,7 @@ public function createOrUpdateSubscriptionElement(StripeSubscription $subscripti } $settings = Plugin::getInstance()->getSettings(); - if ($settings->createUserIfMissing) { + if ($settings->createUserIfMissing && Craft::$app->edition >= CmsEdition::Pro) { $this->ensureUser($subscription, $subscriptionElement); } From fc02179c308ec3a72e799e367d8028fe68380052 Mon Sep 17 00:00:00 2001 From: i-just Date: Fri, 3 Jan 2025 14:51:31 +0000 Subject: [PATCH 2/3] compare values --- src/services/Subscriptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/Subscriptions.php b/src/services/Subscriptions.php index e1878d6..a8cbc3a 100644 --- a/src/services/Subscriptions.php +++ b/src/services/Subscriptions.php @@ -155,7 +155,7 @@ public function createOrUpdateSubscriptionElement(StripeSubscription $subscripti } $settings = Plugin::getInstance()->getSettings(); - if ($settings->createUserIfMissing && Craft::$app->edition >= CmsEdition::Pro) { + if ($settings->createUserIfMissing && Craft::$app->edition->value >= CmsEdition::Pro->value) { $this->ensureUser($subscription, $subscriptionElement); } From 591be1ad34440bf1013d617a0a165d1c4b022715 Mon Sep 17 00:00:00 2001 From: i-just Date: Tue, 7 Jan 2025 07:56:51 +0000 Subject: [PATCH 3/3] updated changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75d5e64..4e554c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Stripe +## Unreleased + +- Fixed a bug where the plugin was attempting to create missing users when `createUserIfMissing` was `true` but the Craft edition didn’t allow for multiple users. ([#72](https://github.com/craftcms/stripe/pull/72)) + ## 1.3.2 - 2024-12-11 - Fixed an error that occurred on Edit Entry screens if Stripe wasn’t configured with an API key. ([#66](https://github.com/craftcms/stripe/pull/66))