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

Redirect to account.php after registering?

edited May 2008 in Vanilla 1.0 Help
Currently, after a user registers (I give 'member' status without admin approving), he/she is automatically logged in and redirected to the forum index. I'd like to redirect them to the account page instead, basically giving them a little nudge so they'd immediately customize their account, thus make them more tied to the community.

How would such a redirect be possible? Thanks!

Comments

  • edited May 2008
    In your conf/settings.php change the setting FORWARD_VALIDATED_USER_URL to the full URL of your account page.

    Since the default Vanilla theme uses the current URI when a user clicks the "Sign In" button, you will need to either change that behavior (in themes/menu.php @ line 10), or make an extension to override it:<?php /* Extension Name: Return URL Override Extension Url: http://lussumo.com/ Description: Forces Users to go to the configured URL upon login Version: 0.1 Author: sirlancelot Author Url: http://lussumo.com/ */ function SignInForm_ChangeReturnUrl(&$SignInForm) { $Context =& $SignInForm->Context; $SignInForm->PostBackParams->Add('ReturnUrl', $Context->Configuration['FORWARD_VALIDATED_USER_URL']); } $Context->AddDelegate('SignInForm', 'PreNoPostBackRender', 'SignInForm_ChangeReturnUrl'); ?>I think that should do it. I've never written an extension before so someone should back me up here :)

    Update: Added Extension metadata to make it identify in Vanilla.
  • Thank you! No idea about creating an extension but I'm using GuestSignIn which adds a login form to the panel, and it must be using its own URL after logging in, so getting directed to account.php when logging in is not a problem for me.

    Would love to see this made into a quick extension though.
  • very nice idea
  • I just made it in to a quick extension :-/

    Copy that code in to a file named default.php and place it in a folder inside the extensions folder: extensions/ReturnUrl/default.php

    Then just enable it through Vanilla's configuration.
  • i tried it but it does not show up in the extension page T_T
  • Oh... so apparently you need all the meta-data for the extension to be valid; I added the rest, hopefully it will work now.
  • aaaa i see thank you so this takes you to the specified account.php (the admins maybe) or the members? (i think it is the individual members account, right?)
  • account.php loads the current logged in user's profile page if no parameters are given. By default all this extension will do is ignore where the user came from before they logged in and force them to go a page; the page defined in the FORWARD_VALIDATED_USER_URL configuration variable.
  • oh your right my bad what was i thinking
  • i think that the requested functionality is far much easier than making an express extension: for changing the page the user is redirected when given membership, just change $Configuration['FORWARD_VALIDATED_USER_URL'] to the desired url.

    this way, the user is only redirected once, not everytime s/he logs in
  • mmm, i think i didn't took much testing, cause my proposed solution just redirects every time a user is registered and also when a registered user logs in, soo sorry, i thought i'd found a nice solution :(
This discussion has been closed.