Home Forums Theme Support Dokan Save registration form fields.

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Nayem 3 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #67865

    Ryan
    Member
    Post count: 9

    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!

    #67967

    Nayem
    Moderator
    Post count: 6480

    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 2 posts - 1 through 2 (of 2 total)

The topic ‘Save registration form fields.’ is closed to new replies.