The static public function login in the includes\classes\users\users.php file allows for an argument of $redirect_to be passed to it but it has not been implemented.
Suggestion is to allow for url to be passed to login function and that upon logon page redirects to that url instead of the current value of 'dashboard/'
Allow redirect_to as an argument to users::login function
-
- Investor
- Posts: 417
- Joined: 19 Dec 2018, 02:33
- Name: Robert McDonald
- Location: Auckland, New Zealand
- Company Name: Unicloud
- Contact:
Re: Allow redirect_to as an argument to users::login function
Hi Sergey this is part of a project we are working on and would be happy to donate for this functionality ?
- nehakakar
- Posts: 4
- Joined: 04 Jul 2023, 11:44
- Name: nehakakar
- Location: India
- Company Name: Alam Groups
- Contact:
Re: Allow redirect_to as an argument to users::login function
Hi rmcdonald,
There is one way to modify the source code of the users::login function in the includes\classes\users\users.php file.
Example:
Locate the users::login function in the includes\classes\users\users.php file. Inside the function, you would need to update the code to accept the redirect_to parameter.
When calling the users::login function in your application, you can now pass the redirect_to parameter to customize the redirection.
After successful login, the user would be redirected to the URL custom-page/.
Test in general or At your browser developer tools to inspect network requests and redirects or use any online tool such as Redirect Checker This can help you identify where the redirection is happening and potentially trace it back to the source.
There is one way to modify the source code of the users::login function in the includes\classes\users\users.php file.
Example:
Locate the users::login function in the includes\classes\users\users.php file. Inside the function, you would need to update the code to accept the redirect_to parameter.
Code: Select all
public static function login($user, $password, $remember = false, $redirect_to = 'dashboard/') {
// Existing login logic
// Redirect to the specified URL after successful login
if ($redirect_to) {
header('Location: ' . $redirect_to);
exit;
}
}
Code: Select all
users::login($username, $password, true, 'custom-page/');
Test in general or At your browser developer tools to inspect network requests and redirects or use any online tool such as Redirect Checker This can help you identify where the redirection is happening and potentially trace it back to the source.