Save registration form fields.

This topic contains 1 reply and 2 voices, and was last updated by Nayem 9 years, 3 months ago
Viewing 1 Posts - 1 through 1 (of 1 total)
Author Posts
August 18, 2015 at 9:12 pm 67865
Nayem Hi, I added a few extra fields to my registration form and have everything saving correctly, but for some reason it forces me to save my fields twice. The first time is while registering, and the second time is while being on the sellers dashboard settings page. Here's the function that creates a new seller.
function custom_create_seller( $user_id, $data ) {
	
    if ( $data['role'] != 'seller' ) {
        return;
    }

    // Get data from my-account register form and update dokan-settings
	$data['address']['street_1'] = sanitize_text_field( $_POST['street_1'] );
	$data['address']['street_2'] = sanitize_text_field( $_POST['street_2'] );
    $data['address']['city'] 	 = sanitize_text_field( $_POST['city'] );
    $data['address']['zip'] 	 = sanitize_text_field( $_POST['zip'] );
    $data['address']['country']  = sanitize_text_field( $_POST['country'] );
    $data['address']['statess']  = sanitize_text_field( $_POST['state'] );
	
    $dokan_settings = array(
        'store_name'     => strip_tags( $_POST['shopname'] ),
        'social'         => array(),
        'address'        => $data['address'],
        'payment'        => $email['payment'],
        'phone'          => $_POST['phone'],
        'show_email'     => 'no',        
        'location'       => '',
        'find_address'   => '',
        'dokan_category' => '',
        'banner'         => 0,
    );

    update_user_meta( $user_id, 'dokan_profile_settings', $dokan_settings );

    Dokan_Email::init()->new_seller_registered_mail( $user_id );
}

add_action( 'woocommerce_created_customer', 'custom_create_seller', 10, 2);
I found this action on the template-settings.php page, but it did not work when adding it this function: do_action( 'dokan_store_profile_saved', $store_id, $dokan_settings ); Could you let me know what I'm doing wrong. Thanks!
August 19, 2015 at 11:20 am 67967
Nayem Nayem

To add and extra field in the registration form you have to add this action- add_action( 'register_form', 'dokan_seller_reg_form_fields' ). You will find this action in dokan/includes/temlate-tags.php file. The template plage of seller registration is dokan/template/global/seller-registration-form.

Thanks.

Viewing 1 Posts - 1 through 1 (of 1 total)