Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Cirrus Soft Posted June 19, 2017 Posted June 19, 2017 Hi, Can someone point me in the right direction or explain briefly how to create hooks to redirect registration to my 3rd party application? I also need hooks for password and email changes if possible. Thank you!
bfarber Posted June 20, 2017 Posted June 20, 2017 Registration: Overload the manage() method of \IPS\core\modules\front\system\register and perform a redirect. Settings: Overload the _username(), _password(), and _email() methods of \IPS\core\modules\front\system\settings and perform redirects. Login: Overload the manage() method of \IPS\core\modules\front\system\login and perform a redirect. Also make a template hook on \IPS\Theme\class_core_front_global on the userBar template and the guestCommentTeaser template to make the login links point directly to your remote login page. Lost pass: overload the manage() method of \IPS\core\modules\front\system\lostpass and perform a redirect.
Cirrus Soft Posted June 23, 2017 Author Posted June 23, 2017 Thank you! This worked well for Registration, but for password and email settings it appears to be trying to load the redirect page into the right column box using ajax. It needs to redirect the top location. using: header("location: url_to_change_email");
bfarber Posted June 26, 2017 Posted June 26, 2017 I'm not sure I understand what you mean. Why would it be loading the redirect page into the right column? For what it's worth, we use this methodology a lot when we implement custom SSO solutions, so I am confident it works as expected.
Cirrus Soft Posted June 30, 2017 Author Posted June 30, 2017 I'm not sure why it is also, maybe it is a new page for the latest version? I've attached a screenshot to show you. In this example, I've simply redirected it to a text file because otherwise, it tries to load my entire page and errors on all the included js and other files. Here is my hook: //<?php /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { exit; } class hook27 extends _HOOK_CLASS_ { /** * Email * * @return string */ protected function _email() { header("location:https://www.footballreach.com/help.txt"); return call_user_func_array( 'parent::_email', func_get_args() ); } }
Stuart Silvester Posted June 30, 2017 Posted June 30, 2017 Ideally you should be using the built in methods for handling things like this, they will automatically handle AJAX requests. What you want to do is something like this: //<?php /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { exit; } class hook27 extends _HOOK_CLASS_ { /** * Email * * @return string */ protected function _email() { \IPS\Output::i()->redirect( \IPS\Http\Url::external( 'https://www.footballreach.com/help.txt' ) ); } }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.