Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Membership › checkbox field at seller registration
- This topic has 4 replies, 2 voices, and was last updated 4 years, 9 months ago by Ramamurthy Krishnan.
- AuthorPosts
- January 22, 2020 at 9:43 am #103152thiemann.kParticipant
Hey Community,
i want to use an checkbox at a seller registration step.
Unfortunately, I really don’t know what the job is called.
vendor-membership/?vmstep=registration
Thanks, Karsten
P.S: here is an excerpt from my snippet
// Display a custom checkbox in My Account > Account details add_action( 'woocommerce_register_form', 'add_account_newsletter_checkbox_field' ); add_action( 'woocommerce_edit_account_form', 'add_account_newsletter_checkbox_field' ); ADD_ACTION( 'WCLOVERS VMSTEP=REGISTRATION', 'add_account_newsletter_checkbox_field' ); function add_account_newsletter_checkbox_field() { woocommerce_form_field( 'receive_newsletter', array( 'type' => 'checkbox', 'class' => array('form-row-wide'), 'label' => __( 'Möchtest Du unseren Newsletter?', 'woocommerce' ), 'clear' => true, ), get_user_meta(get_current_user_id(), 'receive_newsletter', true ) ); }
- January 22, 2020 at 5:10 pm #103204Ramamurthy KrishnanKeymaster
Hi,
No need to use custom coding for this. You can go to store-manager->Settings->Vendor Registration and create custom fields ( checkbox ) under “Registration Form Custom Fields”.
Thanks,
- January 22, 2020 at 8:44 pm #103232thiemann.kParticipant
Hey Molay Das, thanks for your answer! Thats really simple…
I totally forgot about this function ..
but the problem I still have is that I can’t get Mailpoet involved there …
a checkbox yes, but not in combination with our newsletter pluginThanks, Karsten
- January 23, 2020 at 9:41 am #103335thiemann.kParticipant
the checkbox for the newsletter is displayed correctly on the standard register page (/wp-signup.php).
Image: https://ibb.co/b368hVsThe checkbox is active in the MailPoet settings.
Image: https://ibb.co/DVdQ47zBut unfortunately I don’t get this implemented in the registry by WcfM
This is the original code from mailpoet/lib/subscription/registration.php
<?php namespace MailPoet\Subscription; use MailPoet\Settings\SettingsController; use MailPoet\Subscribers\SubscriberActions; use MailPoet\WP\Functions as WPFunctions; class Registration { /** @var SettingsController */ private $settings; /** @var SubscriberActions */ private $subscriber_actions; function __construct( SettingsController $settings, SubscriberActions $subscriber_actions ) { $this->settings = $settings; $this->subscriber_actions = $subscriber_actions; } function extendForm() { $label = $this->settings->get( 'subscribe.on_register.label', WPFunctions::get()->__('Yes, please add me to your mailing list.', 'mailpoet') ); print '<p class="registration-form-mailpoet"> <label for="mailpoet_subscribe_on_register"> <input type="checkbox" id="mailpoet_subscribe_on_register" value="1" name="mailpoet[subscribe_on_register]" /> ' . esc_attr($label) . ' </label> </p>'; } function onMultiSiteRegister($result) { if (empty($result['errors']->errors)) { if ( isset($_POST['mailpoet']['subscribe_on_register']) && (bool)$_POST['mailpoet']['subscribe_on_register'] === true ) { $this->subscribeNewUser( $result['user_name'], $result['user_email'] ); } } return $result; } function onRegister( $errors, $user_login, $user_email = null ) { if ( empty($errors->errors) && isset($_POST['mailpoet']['subscribe_on_register']) && (bool)$_POST['mailpoet']['subscribe_on_register'] === true ) { $this->subscribeNewUser( $user_login, $user_email ); } return $errors; } private function subscribeNewUser($name, $email) { $segment_ids = $this->settings->get( 'subscribe.on_register.segments', [] ); if (!empty($segment_ids)) { $this->subscriber_actions->subscribe( [ 'email' => $email, 'first_name' => $name, ], $segment_ids ); } } }
I tried to use parts of it … the checkbox is shown, but it doesn’t work.
// Display a custom checkbox in My Account > Account details add_action( 'woocommerce_register_form', 'add_account_newsletter_checkbox_field' ); add_action( 'woocommerce_edit_account_form', 'add_account_newsletter_checkbox_field' ); function add_account_newsletter_checkbox_field() { print '<p class="registration-form-mailpoet"> <label for="mailpoet_subscribe_on_register"> <input type="checkbox" id="mailpoet_subscribe_on_register" value="1" name="mailpoet[subscribe_on_register]" /> ' . esc_attr($label) . ' </label> </p>';
- January 23, 2020 at 4:24 pm #103412Ramamurthy KrishnanKeymaster
Hi,
The section which I explained is only for adding custom fields in vendor registration form but if you wish to implement any newsletter to it then it will require paid custom development.
Please contact us here for the purpose – https://wclovers.com/woocommerce-multivendor-customization/Thanks,
- AuthorPosts
- You must be logged in to reply to this topic.