diff --git a/integrations/wp-registration-form/class-registration-form.php b/integrations/wp-registration-form/class-registration-form.php index c9f5a24a..3a17defe 100755 --- a/integrations/wp-registration-form/class-registration-form.php +++ b/integrations/wp-registration-form/class-registration-form.php @@ -34,6 +34,7 @@ public function add_hooks() add_action('um_after_register_fields', [ $this, 'maybe_output_checkbox' ], 20); add_action('register_form', [ $this, 'maybe_output_checkbox' ], 20); add_action('woocommerce_register_form', [ $this, 'maybe_output_checkbox' ], 20); + add_action('user_new_form', [ $this, 'maybe_output_user_new_checkbox' ], 20); } add_action('um_user_register', [ $this, 'subscribe_from_registration' ], 90, 1); @@ -45,6 +46,35 @@ public function add_hooks() } } + /** + * Output checkbox in the admin "Add New User" form. + */ + public function maybe_output_user_new_checkbox($form_type) + { + if ('add-new-user' !== $form_type || $this->shown) { + return; + } + + $this->shown = true; + $this->output_user_new_checkbox(); + } + + /** + * Output checkbox as a form-table row. + */ + public function output_user_new_checkbox() + { + $checkbox_id = esc_attr($this->checkbox_name); + echo '
| ', esc_html__('Mailchimp subscribe', 'mailchimp-for-wp'), ' | '; + echo ''; + $this->output_checkbox(); + echo ' | '; + echo '
|---|