@@ -168,49 +168,58 @@ private static function registerJoinFormBlock()
168168
169169 $ custom_fields = self ::createCustomFieldsField ();
170170
171+ $ block_fields = [
172+ Field::make ('separator ' , 'ck_join_form ' , 'CK Join Form ' ),
173+ $ joined_page_association ,
174+ Field::make ('checkbox ' , 'require_address ' )->set_default_value (true ),
175+ Field::make ('checkbox ' , 'hide_address ' )
176+ ->set_help_text ('Check to completely hide the address section from the form. ' ),
177+ Field::make ('checkbox ' , 'require_phone_number ' )->set_default_value (true ),
178+ Field::make ('checkbox ' , 'ask_for_additional_donation ' )
179+ ->set_help_text ('Has no effect when Donation Supporter Mode is enabled. ' ),
180+ Field::make ('checkbox ' , 'donation_supporter_mode ' )
181+ ->set_help_text (
182+ 'Enable Supporter Mode: shows donation frequency and amount first, ' .
183+ 'before personal details and payment. Skips the membership plan step. ' .
184+ 'Requires block-level membership plans to be configured (used as donation tiers). ' .
185+ 'One-off donations require Stripe. They are not available with Direct Debit only. '
186+ ),
187+ Field::make ('checkbox ' , 'hide_home_address_copy ' )
188+ ->set_help_text ('Check to hide the copy that explains why the address is collected. ' ),
189+ Field::make ('checkbox ' , 'include_skip_payment_button ' )
190+ ->set_help_text (
191+ 'Check to include an additional button on the first page to skip to the thank you page ' .
192+ '(which could include a form for additional questions) '
193+ ),
194+ Field::make ('checkbox ' , 'is_update_flow ' , 'Is Update Flow (e.g. for existing members) ' )
195+ ->set_help_text (
196+ 'Check to skip collecting member details (e.g. name, address). If checked, this page must ' .
197+ 'be linked to with the email URL search parameter set, e.g. /become-paid-member/?email=someone@example.com. ' .
198+ 'This can be achieved by using the CK Join Form Link block on a landing page, and linking to this page. '
199+ ),
200+ $ custom_fields ,
201+ $ custom_membership_plans ,
202+ Field::make ('text ' , 'custom_webhook_url ' )
203+ ->set_help_text ('Leave blank to use the default Join Complete webhook from the settings page. ' ),
204+ Field::make ('text ' , 'custom_sidebar_heading ' )
205+ ->set_help_text ('Leave blank to use the default from settings page. ' ),
206+ Field::make ('text ' , 'custom_membership_stage_label ' )
207+ ->set_help_text ('Leave blank to use the default from settings page. ' ),
208+ Field::make ('text ' , 'custom_joining_verb ' )
209+ ->set_help_text ('Leave blank to use the default from settings page (e.g., "Joining"). ' ),
210+ ];
211+
212+ if (Settings::get ("STRIPE_DIRECT_DEBIT_ONLY " )) {
213+ $ block_fields [] = Field::make ('checkbox ' , 'allow_cards_override ' )
214+ ->set_help_text (
215+ 'Override the global "Direct Debit Only" setting for this block, ' .
216+ 'allowing card payments alongside Direct Debit. '
217+ );
218+ }
219+
171220 /** @var Block_Container $join_form_block */
172221 $ join_form_block = Block::make (__ ('CK Join Form ' , 'common-knowledge-join-flow ' ))
173- ->add_fields (array (
174- Field::make ('separator ' , 'ck_join_form ' , 'CK Join Form ' ),
175- $ joined_page_association ,
176- Field::make ('checkbox ' , 'require_address ' )->set_default_value (true ),
177- Field::make ('checkbox ' , 'hide_address ' )
178- ->set_help_text ('Check to completely hide the address section from the form. ' ),
179- Field::make ('checkbox ' , 'require_phone_number ' )->set_default_value (true ),
180- Field::make ('checkbox ' , 'ask_for_additional_donation ' )
181- ->set_help_text ('Has no effect when Donation Supporter Mode is enabled. ' ),
182- Field::make ('checkbox ' , 'donation_supporter_mode ' )
183- ->set_help_text (
184- 'Enable Supporter Mode: shows donation frequency and amount first, ' .
185- 'before personal details and payment. Skips the membership plan step. ' .
186- 'Requires block-level membership plans to be configured (used as donation tiers). ' .
187- 'One-off donations require Stripe. They are not available with Direct Debit only. '
188- ),
189- Field::make ('checkbox ' , 'hide_home_address_copy ' )
190- ->set_help_text ('Check to hide the copy that explains why the address is collected. ' ),
191- Field::make ('checkbox ' , 'include_skip_payment_button ' )
192- ->set_help_text (
193- 'Check to include an additional button on the first page to skip to the thank you page ' .
194- '(which could include a form for additional questions) '
195- ),
196- Field::make ('checkbox ' , 'is_update_flow ' , 'Is Update Flow (e.g. for existing members) ' )
197- ->set_help_text (
198- 'Check to skip collecting member details (e.g. name, address). If checked, this page must ' .
199- 'be linked to with the email URL search parameter set, e.g. /become-paid-member/?email=someone@example.com. ' .
200- 'This can be achieved by using the CK Join Form Link block on a landing page, and linking to this page. '
201- ),
202- $ custom_fields ,
203- $ custom_membership_plans ,
204- Field::make ('text ' , 'custom_webhook_url ' )
205- ->set_help_text ('Leave blank to use the default Join Complete webhook from the settings page. ' ),
206- Field::make ('text ' , 'custom_sidebar_heading ' )
207- ->set_help_text ('Leave blank to use the default from settings page. ' ),
208- Field::make ('text ' , 'custom_membership_stage_label ' )
209- ->set_help_text ('Leave blank to use the default from settings page. ' ),
210- Field::make ('text ' , 'custom_joining_verb ' )
211- ->set_help_text ('Leave blank to use the default from settings page (e.g., "Joining"). ' ),
212-
213- ));
222+ ->add_fields ($ block_fields );
214223 $ join_form_block ->set_render_callback (function ($ fields , $ attributes , $ inner_blocks ) {
215224 self ::enqueueBlockCss ();
216225 self ::echoEnvironment ($ fields , self ::NORMAL_BLOCK_MODE );
@@ -463,7 +472,9 @@ function ($o) {
463472 "REQUIRE_PHONE_NUMBER " => $ fields ["require_phone_number " ] ?? true ,
464473 "SENTRY_DSN " => Settings::get ("SENTRY_DSN " ),
465474 "STRIPE_DIRECT_DEBIT " => Settings::get ("STRIPE_DIRECT_DEBIT " ),
466- "STRIPE_DIRECT_DEBIT_ONLY " => Settings::get ("STRIPE_DIRECT_DEBIT_ONLY " ),
475+ "STRIPE_DIRECT_DEBIT_ONLY " => !empty ($ fields ['allow_cards_override ' ])
476+ ? false
477+ : Settings::get ("STRIPE_DIRECT_DEBIT_ONLY " ),
467478 "STRIPE_PUBLISHABLE_KEY " => Settings::get ("STRIPE_PUBLISHABLE_KEY " ),
468479 "SUBSCRIPTION_DAY_OF_MONTH_COPY " => Settings::get ("SUBSCRIPTION_DAY_OF_MONTH_COPY " ),
469480 "USE_CHARGEBEE " => Settings::get ("USE_CHARGEBEE " ),
0 commit comments