1

I'm trying to create a reference registration system in Wordpress. The idea is that the user will click a link which will contain wp-login.php?action=register&ref=12345

I'm hooking into the 'register_form' action hook and adding a reference number hidden input and on registration use that reference number to do whatever i need to do with it.

The issue appears when the user gets something wrong in the registration form. The problem is that he will be taken to wherever the action attribute of the register form states which is "wp-login.php?action=register" without the ref parameter. I'm looking for a way to modify that action attribute. I've looked in the wp-login.php file and it seems that there's no filter there.

I know there's always javascript, but is there another wordpressy way to do this?

  • Try cookies or local storage. – Bainternet Aug 19 '11 at 16:39
1

You should be able to hook into the register_form_validation hook (which may be the same hook you're already using. I'm just not sure where they do the validation) and add something like:

function my_register_validation() {
if(isset($_GET['ref'])){ 
   header('Location: http://www.example.com/wp-login?action=register&ref=$_GET[ref]');

}
add_filter(' my_register_validation', 'register_form');

I think that is the right idea the code above is untested but I think it gets you on the right track.

You said you were adding it to a secret form value so you might be able to use $_POST['secret_value'] instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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