Redirect to account.php after registering?
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!
How would such a redirect be possible? Thanks!
0
This discussion has been closed.
Comments
conf/settings.phpchange the settingFORWARD_VALIDATED_USER_URLto 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 hereUpdate: Added Extension metadata to make it identify in Vanilla.
Would love to see this made into a quick extension though.
Copy that code in to a file named
default.phpand place it in a folder inside the extensions folder:extensions/ReturnUrl/default.phpThen just enable it through Vanilla's configuration.
account.phploads 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 theFORWARD_VALIDATED_USER_URLconfiguration variable.this way, the user is only redirected once, not everytime s/he logs in