2 registration pages apartment | WordPress.org

[ad_1]

hi @vandehee,

We currently do not have that feature on vendor dedicated registration page, I’ll raise a feature request for this.

Having said that, what you can do is create a custom registration form and have it automatically assign the vendor role and then a custom code to activate the vendor role.

You may need to use a 3rd party plugin that allows you to create a form and assigned certain roles when registering through the form, also please reach out to said plugin support team going forward as you may need to tweak the snippets:

if ( ! function_exists( 'wcv_update_vendor_status' ) ) {
	/**
	 * Update vendor status
	 *
	 * @param  int $user_id the user id.
	 */
	function wcv_update_vendor_status( $user_id ) {
		$user = get_user_by( 'id', $user_id );
		if ( in_array( 'vendor', $user->roles, true ) ) {
			update_user_meta( $user_id, '_wcv_vendor_status', 'active' );
		}
	}
	add_action( 'user_register', 'wcv_update_vendor_status', 10, 1 );
}

or

if ( ! function_exists( 'wcv_update_vendor_status_on_add_role' ) ) {
    /**
     * Update vendor status on add role
     *
     * @param int $user_id the user id.
     * @param string $role the new role.
     */
    function wcv_update_vendor_status_on_add_role( $user_id, $role ) {
        if ( 'vendor' === $role ) {
            update_user_meta( $user_id, '_wcv_vendor_status', 'active' );
        }
    }
    add_action( 'add_user_role', 'wcv_update_vendor_status_on_add_role', 10, 2 );
}

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer