Problems with redirect & adding extra fields in signup page

Started by ianprend, November 16, 2009, 03:28:43 AM


Now that I have the cookies sorted out there is just one more problem to solve. I've noticed that this has been mentioned by others on other posts but no answers have been forthcoming.

The problem is that when you add extra fields to the signup page no matter which order you put them in the program seems to regard column 4 in the user management as the redirect url. So if you have the columns listed in users.def as follows..

First Name,STRING,15
Last Name,STRING,15
Redirect URL,STRING,15

...then when you login to the protected page it redirects to or whatever you call that 4th column in user management when it should go to on successful login.

Can someone please tell me which file deals with the redirect and how to stop it doing this. It seems like a common problem but no one has posted an answer as yet. It all works perfectly if I don't have the extra fields and just have this in users.def..

Redirect URL,STRING,15

..but as soon as I add the extra fields it reverts to the situation described above. I really would prefer to have those extra fields in the signup process so if anyone can help I would be most grateful. :)


Solved! For those of you who are wanting to put extra fields into the signup form here is the solution to stop it redirecting to whatever the value of the 4th column of admin manager.

The key is to move the columns over one place by putting in a dummy redirect url field.

Go to signup.php and look for the following code..

      die('"USE_USERNAME" must be set to "true" when "USE_EMAIL" is set to "true"');

  function parse_user_input() {
    $this->login = isset($_POST['access_login']) ? $_POST['access_login'] : '';
    $this->pass = $_POST['access_password'];
    $this->email = LOGIN_AS_EMAIL
                 ? $this->login
                 : (isset($_POST['access_email']) ? $_POST['access_email'] : '');

then add this line underneath..

$this->redirect = $_POST['landing'];

You can then add the other fields below this such as..

$this->firstname = $_POST['firstname'];
$this->lastname = $_POST['lastname'];
$this->address = $_POST['address'];
$this->telephone = $_POST['telephone'];

These are extra fields I used but you can make up your own. Now go down further and find the following code...

fputs($fusers, "\n" . $this->login. ',' . $this->pass . ',' . $this->email);

and add the following extra info (marked in red)

fputs($fusers, "\n" . $this->login. ','. $this->pass. ','. $this->email. ','. $this->redirect);

You can then add the extra field names after that such as...

fputs($fusers, "\n" . $this->login. ','. $this->pass. ','. $this->email. ','. $this->redirect. ','. $this->firstname. ','. $this->lastname. ','. $this->address. ',' . $this->telephone);

Now the last thing you have to do is open up login_form.php and add the following code anywhere in between the <form> </form> tags...

<input name="landing" type="hidden" value="">

You have now given the redirect field a dummy value of nothing which will show up as a blank in the redirect url column (The 4th Column) in admin manager. The other fields you have added will then be automatically entered into their proper columns. Make sure you have them in order in users.def


Redirect URL,STRING,12
First Name,STRING,14
Last Name,STRING,14

Now whenever anyone logs in they will be taken to the default url you set up in settings.php