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.

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!


  • Options
    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: Description: Forces Users to go to the configured URL upon login Version: 0.1 Author: sirlancelot Author Url: */ 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.
  • Options
    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.
  • Options
    very nice idea
  • Options
    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.
  • Options
    i tried it but it does not show up in the extension page T_T
  • Options
    Oh... so apparently you need all the meta-data for the extension to be valid; I added the rest, hopefully it will work now.
  • Options
    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?)
  • Options
    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.
  • Options
    oh your right my bad what was i thinking
  • Options
    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
  • Options
    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.