Up to 50 percent off

Dokan plugin: Get rid of "Customer / Seller" fields on registration page

  • Home
  • Forums
  • Dokan
  • Dokan plugin: Get rid of "Customer / Seller" fields on registration page
This topic contains 13 reply and 3 voices, and was last updated by Nayem 9 years, 5 months ago
Viewing 13 Posts - 1 through 13 (of 13 total)
Author Posts
January 6, 2015 at 6:29 am 33428
Nayem 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.
January 6, 2015 at 3:38 pm 33456
Nayem Nayem

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 🙂

January 8, 2015 at 10:13 am 33625
Gabriel Gabriel

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.

January 9, 2015 at 3:45 pm 33708
Nayem Nayem

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 🙂

January 10, 2015 at 6:26 am 33752
Gabriel Gabriel

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.

January 11, 2015 at 11:53 am 33807
Nayem Nayem

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 🙂

January 21, 2015 at 1:27 am 34652
Gabriel Gabriel

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

January 21, 2015 at 11:23 am 34685
Nayem Nayem

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 🙂

February 4, 2015 at 8:42 am 35683
Gabriel Gabriel

Worked perfectly.

Thanks, Nayem!

February 4, 2015 at 10:20 am 35685
Nayem Nayem

Hello Gabriel,

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

Thank you 🙂

February 5, 2015 at 8:36 am 35805
Gabriel Gabriel

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?

February 5, 2015 at 10:55 am 35837
Nayem Nayem

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 🙂

June 4, 2015 at 1:00 am 46054
trabajosdm trabajosdm

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

June 4, 2015 at 3:56 pm 46111
Nayem Nayem

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 13 Posts - 1 through 13 (of 13 total)