Home Forums Theme Support Dokan Dokan plugin: Get rid of "Customer / Seller" fields on registration page

This topic is: not resolved

This topic contains 13 replies, has 3 voices, and was last updated by  Nayem 3 years, 10 months ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #33428

    Gabriel
    Member
    Post count: 15

    Hi,

    How can I get rid of the part of the registration page where each new user has to choose whether they are a seller or a customer?

    I have already made it so that every new user is a seller by default and that they automatically are able to sell.

    But I still need to get rid of the actual part of the registration page where it asks them to choose.

    Thanks.

    #33456

    Nayem
    Moderator
    Post count: 6480

    Hello Gabriel,

    Please open Dokan-plugin/includes/template-tags.php. In line number 347 you will see this code $role = isset( $_POST['role'] ) ? $_POST['role'] : 'customer';. You have to change the customer to seller. After changing this code will look like as this- $role = isset( $_POST['role'] ) ? $_POST['role'] : 'seller';. Then you have to comment out line number 393-404. Please check this and let me know.

    Thank you ๐Ÿ™‚

    #33625

    Gabriel
    Member
    Post count: 15

    Hi Nayem, thanks for the help!

    Nizam gave me the following code to put in functions.php in my child theme:

    add_filter( ‘woocommerce_new_customer_data', ‘gabe_new_user_data' );
    function gabe_new_user_data( $data ) {
    $data[‘role'] = ‘seller';
    return $data;
    }

    Would this conflict with the code you gave me?
    Also, is there a way to add code to functions.php that would essentially negate lines 393-404?
    I heard that if you don't put changes in functions.php, you lose them when you update the plugin.
    Is this true?

    Thanks Nayem.

    #33708

    Nayem
    Moderator
    Post count: 6480

    Hello Garible,

    I think my given code will not conflict with this code you have provided.

    Yes you are right. If you do customization in main file then it will be lost after updating the plugin. You have to customize in a child theme because child theme is safe. You have to change those code in your child theme. If you can provide your ftp details then i can change this for you.

    Please provide your login details by using this form- http://wedevs.com/provide-login-details/ and also provide your ftp details here in a private reply.

    Thank you ๐Ÿ™‚

    #33752

    Gabriel
    Member
    Post count: 15

    Hi Nayem,

    Thanks for the offer!

    I'm actually trying to teach myself programming so I try to do as much as I can myself. Even if it is just entering code that people give me or that I find online.

    Do I just put the codes that you gave me into the child theme functions.php? Or would I have to enter in new code? I'm not too sure about how I would be able to comment out the “customer/seller” fields (lines 393-404) in the registration page through customizing the child theme.

    How do you stop the original code from overriding the new child theme code?
    I've only had some light C and Ruby on Rails training prior to this.

    Thanks, Nayem.

    #33807

    Nayem
    Moderator
    Post count: 6480

    Hello Gabriel,

    I think giving instruction is not easy for this. But i can provide you some step to do this. Hope it will help you.

    You have use remove_action in your child theme's function.php . You have to remove the action of that function which contains those code for this registration filed. First of all in the child theme function.php – you have to use remove_action then you have to use a new add_action then you have to create a new function then in this function you can do whatever you want to do to customize. You can also read this to know more how to modify parent file by child theme- http://code.tutsplus.com/tutorials/how-to-modify-the-parent-theme-behavior-within-the-child-theme–wp-31006.

    Thank you ๐Ÿ™‚

    #34652

    Gabriel
    Member
    Post count: 15

    Hi Nayem,

    Was trying to change the fields that you said. Should I also change the second line?

    $role = isset( $_POST[‘role'] ) ? $_POST[‘role'] : ‘customer';
    $role_style = ( $role == ‘customer' ) ? ‘ style=”display:none”‘ : ”;
    ?>

    Should I change
    $role_style = ( $role == ‘customer' ) ? ‘ style=”display:none”‘ : ”;
    So that it says
    $role_style = ( $role == ‘seller' ) ? ‘ style=”display:none”‘ : ”;

    Also, if I comment out lines 393-404, will that cause any trouble later on? It seems from the code that Dokan needs that info for Seller info. If I comment that out, will it be missing seller info (first name, last name, address, etc)?

    Is there a way that I can have all this information as a part of registration, but above the rest of the registration fields?

    Thanks again for all the help, Nayem.

    Best,
    -Gabe

    #34685

    Nayem
    Moderator
    Post count: 6480

    Hello Garibel,

    You have to comment out this line

    <label class="radio">
                <input type="radio" name="role" value="customer"<?php checked( $role, 'customer' ); ?>>
                <?php _e( 'I am a customer', 'dokan' ); ?>
    </label>

    .
    And not need to change this line-$role_style = ( $role == โ€˜customerโ€™ ) ? โ€˜ style=โ€display:noneโ€โ€˜ : โ€;.

    Please check after doing your customization. It will work.

    Thank you ๐Ÿ™‚

    #35683

    Gabriel
    Member
    Post count: 15

    Worked perfectly.

    Thanks, Nayem!

    #35685

    Nayem
    Moderator
    Post count: 6480

    Hello Gabriel,

    I am very glad to know that. I am marking this topic as resolved.

    Thank you ๐Ÿ™‚

    #35805

    Gabriel
    Member
    Post count: 15

    Nayem,

    I tried to to use the Child theme again and see if I could remove the registration field and then add in new ones like you said.

    In my functions.php of my child theme I typed in the following (to try to first remove the function):

    remove_action( ‘woocommerce_register_form_start', ‘dokan_seller_reg_form_fields' );

    This didn't work.

    Can you tell me what I did wrong?

    #35837

    Nayem
    Moderator
    Post count: 6480

    Hello Gabriel,

    1. You have to remove this action- remove_action('register_form','dokan_seller_reg_form_fields');
    2. Create your own fuction.
    3. Add an action like this- add_action('register_form','Your own function name');

    Please check and let me know. Thank you ๐Ÿ™‚

    #46054

    trabajosdm
    Participant
    Post count: 9

    Najem , how are you , I , like Gabriel , I want you on record , only to be directly to vendors and not as it now appears , could help to add functions to file child?

    And you can add city field?

    I want that when people enter , they see only the products and shops in the city they choose

    #46111

    Nayem
    Moderator
    Post count: 6480

    Hello,

    We are working on a feature – Radius search. Customer will be able to search nearby seller from their own location. This feature will be available in near future release. Please keep patience.

    Thanks.

Viewing 14 posts - 1 through 14 (of 14 total)

The topic ‘Dokan plugin: Get rid of "Customer / Seller" fields on registration page’ is closed to new replies.