0

I am trying to make a separate registration form for 2 types of users on my website: e.g. apples and oranges.

Therefore, I use the following GET requests:

  • www.website.be/wp-login.php?action=register&role=apple
  • www.website.be/wp-login.php?action=register&role=orange

These URLs are called when a user pushes on the respective button for registering oranges or apples and a specific registration form appears. My code also checks whether their are no empty fields. And if there are, it gives an error to the $errors variable.

Till now, everything works fine. BUT: when an error occurs (as e.g. an empty field), it plots the error information on www.website.be/wp-login.php?action=register. This means: the role specific fields are missing here!

Can someone help me how to plot the errors on the correct page (e.g. www.website.be/wp-login.php?action=register&role=apple) without erasing the completed fields?

Thanks in advance!

1 Answer 1

0

I think I found the solution myself. When I adjusted the declaration of the registration form:

<form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post" novalidate="novalidate">    

To the following:

<form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register&role='.$_GET['role'], 'login_post') ); ?>" method="post"  novalidate="novalidate">    

Then my problem is solved and the registration page is not redirected to the standard registration url.

I hope this can help other persons too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.