• Resolved YellowPlanet

    (@yellowplanet)


    I have a site with Woocommerce, where people can register as customers and as authors, who can also post products. The authors need to fill out more information. They will be normal customers, until the admin changes their role to author. Originally I was using the Woocommerce login/register page and added extra fields there for author registration with Wp-members. However, the extra information was not saved. I found this but wasn’t able to fix it
    http://rocketgeek.com/forums/topic/extra-fields-are-not-populated-using-wp-members-2-9-2/

    I decided to make a separate WP-members registration page for author registration, and provide a link to that in the Woocommerce register page. That page and registration works now. The problem is, that the extra fields are also on the Woocommerce registration page and they cause some problems. I hid them, but none of them can be required, because they are still there. I added a password field to the author registration and now the customer registration does not work anymore, because Woocommerce has its own password field. The one added from WP-members is hidden, but it’s required by default I guess, and now there is an error saying “Please enter an account password” when trying yo register from the Woocommerce page.

    So, how could I remove the WP-members fields from the Woocommerce registration page for customer, and only keep them on the Wp-members registration page for authors? Or at least somehow get rid of the password error on that page, so customers would able to register too.

    https://wordpress.org/plugins/wp-members/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter YellowPlanet

    (@yellowplanet)

    Anyone?

    I tried to use the wpmem_register_form filter and return an empty form. That removes the form on the WP-members register page, but nothing happens on the Woocommerce page. I guess the hooks don’t work there?

    I’m able to remove the form with jQuery and then the Woocommerce customer registration works, but I don’t think that’s an ideal solution. Is there any other way to remove the WP-members fields from the Woocommerce registration form?

    Plugin Author Chad Butler

    (@cbutlerjr)

    If I understand your question, you have fields that are added using the WP-Members fields tab that you don’t want to show in the Woocommerce form?

    I suspect that the WC form uses the WP form, which WP-Members also hooks into (for users that want to use the backend registration form, or need the custom fields to show in other forms).

    Those fields are added to WP’s registration with WP’s register_form filter:

    add_filter( 'register_form', 'wpmem_wp_register_form' );

    So what you need to do is unhook that function from that filter. You can do that using remove_filter:

    remove_filter( 'register_form', 'wpmem_wp_register_form' );

    You’ll need to hook that to something. And you might need to experiment with the priority. WP-Members has an action hook after it loads all its settings that might work. So you might be able to set it up like this:

    add_action( 'wpmem_after_init', 'my_remove_form_filter' );
    function my_remove_form_filter() {
         remove_filter( 'register_form', 'wpmem_wp_register_form' );
    }
    Thread Starter YellowPlanet

    (@yellowplanet)

    I think that worked, thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove WP-members fields from Woocommerce registration’ is closed to new replies.