Joomla 3 Login redirect - works in the login module, but does not work with the component login view

I am working on Joomla 3.x I have a requirement to redirect to a new page after logging in. I know that in the input module in the module there is an option in which we can specify the "login redirection page". This works great. it redirects to the place where I want.

However, the problem is: After the user creates a new account (I turned off the registration process, so activation of links by e-mail is not required), the user is presented with a login form (not from the module) from the component com_users. After providing the credentials, instead of redirecting to the desired page that I installed in the module manager, it goes to the profile page of the com_users component. index.php / component / users /? = profile view

I need your suggestions for changing this default behavior. Is there a place where I can set up a redirect page for the com_users component, similar to the way we have for the login module? Do I need to switch to Joomla kernel code changes? Or do I need to create a plugin that can run after the OnLoginUser event?

Waiting for suggestions from you guys.

Thanks and greetings, Gaurav Pandya

+5
source share
2 answers

In setting the menu item (type of menu item → login form), please check the options tab, there is a field in which you can set name forwarding.

EDIT:

If your login is not connected to the menu, try overriding: components / com_users / views / Login / TMPL / default_login.php line 79:

<input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('login_redirect_url', $this->form->getValue('return'))); ?>" /> 
+3
source

In fact, there is no need to override the plugin or any template.

If you use the menu item to publish the login page, you just need to add the absolute URL in the "name forwarding" field.

eg. http://www.somesite.com/my-account and not / My Account

For some reason, the relative url (/ my-account) is considered an external URL and is redefined in the controller, so it is redirected to "my-account / profile".

Hope this helps someone.

0
source

Source: https://habr.com/ru/post/1200101/


All Articles