Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Universal sign-in with ReturnUrl

edited July 2006 in Vanilla 1.0 Help
I'm building a site and I'd like it to have one univeral sign-in that will allow the member access onto the forum (vanilla of course) and other features within the site. I noticed this snippet:

$this->ReturnUrl = urldecode(ForceIncomingString('ReturnUrl', '')); if ($this->ReturnUrl != '') $this->PostBackParams->Add('ReturnUrl', $this->ReturnUrl);
So my question(s) are:

1. How do I specify a ReturnUrl?
2. If successful, how do I access the session variables that vanilla sets?
3. How can I add additional inputs / variable during registration?

Thanks for your help guys!

Comments

  • Options
    MarkMark Vanilla Staff
    You specify a ReturnUrl just like that. When linking to the sign in page, add this to the link:

    people.php?ReturnUrl=where/to/send/them/after.html

    As for accessing the session / cookie variables, there's a pretty decent summary of that over here:

    http://lussumo.com/community/discussion/2654/?Focus=32933#Comment_32933

    Finally, you can take a look at the discovery extension or the extended application form extension to see how I added inputs to registration over there:

    Discovery Extension
    Extended Application Form Extension
  • Options
    edited July 2006
    Thanks Mark! One last thing, when specifying the ReturnUrl through the link, where are you referencing from? The root directory or the forum directory? If I wanted to retrun to an index page one directory above the forum, would it be this:

    people.php?ReturnUrl=../index.php
    Or this:

    people.php?ReturnUrl=/home/user/index.php
    Neither seem to be working for me.
  • Options
    i think you must do
    people.php?ReturnUrl=http://www.domain.com/sub/index.php
  • Options
    Hmm, none of these solutions seem to work. Does anyone have a working example of the ReturnUrl variable being set via URL?
  • Options
    my way is right as if you log out and hover over the sign in link (top right) it is what i said. Obviously you have to change the domain.com and sub to the correct path for you
  • Options
    edited July 2006
    I see what you mean, Immersion, yet when I alter the URL from

    people.php?ReturnUrl=http://www.MyRealDomain.com/forum/
    to

    people.php?ReturnUrl=http://www.MyRealDomain.com
    it still returns to the forum directory. Do I have to set a variable somewhere else maybe?
  • Options
    MarkMark Vanilla Staff
    That's odd. The ReturnUrl should be stored in a hidden input in the page. The next step would be to click your link and then look in the xhtml to make sure that it is getting it properly.
  • Options
    I've done some primary digging, and here's what I've come up with. When you access the sign-in page without a ReturnUrl set, there is a hidden input that stores a blank value. Somehow the script knows to return the user to the main forum page. If you specify a ReturnUrl directly within the URL, the hidden input is updated, and the user is returned to the forum. If you change the ReturnUrl within the URL, no matter what you change it to, the hidden input is updated, but the user is still returned to the main forum, despite the ReturnUrl pointing somewhere else entirely.
  • Options
    MarkMark Vanilla Staff
    edited July 2006
    Here is the logic behind the ReturnUrl on the SignInForm control in Vanilla 1:

    // Automatically redirect if this user isn't a user administrator or there aren't any new applicants $AutoRedirect = 1; if ($this->Context->Session->User->Permission('PERMISSION_APPROVE_APPLICANTS')) { $this->ApplicantCount = $UserManager->GetApplicantCount(); if ($this->ApplicantCount > 0) $AutoRedirect = 0; } if ($this->ReturnUrl == '') { $this->ReturnUrl = $this->Context->Configuration['FORWARD_VALIDATED_USER_URL']; } else { $this->ReturnUrl = str_replace('&', '&', $this->ReturnUrl); } if ($AutoRedirect && $this->ReturnUrl != '') { header('location: '.$this->ReturnUrl); // die(); }

    Here is the same thing in plain english:

    If the user has permission to approve new applicants and there are new applicants, don't automatically forward him/her. Otherwise... If there is a return url, do some formatting so it works properly, and send the user to that url.
  • Options
    edited July 2006
    even this one work (log out first) http://lussumo.com/community/people.php?ReturnUrl=http://www.google.co.uk/search?hl=en&q=Vanilla&btnG=Google+Search&meta=
  • Options
    It does work with the above, but it still won't work on my forum. To wit: http://www.moxiecinema.com/forum/people.php?ReturnUrl=http://www.google.com The username and password are both "test." It should redirect to google, but still goes to the main forum page.
  • Options
    well for me that link takes me to google when i sign in
  • Options
    That's odd. Why wouldn't it for me? I'm using Firefox 1.5.0.4 on WinXP. Perhaps if I clear my cache... now it works! What do you think was causing the problem? I cleared my cache and cookies and the problem was resolved. Weird.
  • Options
    you were still logged in I think
  • Options
    No, I was logged out.
This discussion has been closed.