1

When a login form menu Item Type is created, is there a way to set the redirect URL to the page the user click the login link to reach the login form page and set it to some sort of default if the user manually typed in the login url?

This is somewhat possible with the Login Module where the Default Redirect URL is the page the user enter their login details but there is no such option for the Menu Item. Or will I have to resort to some component like 'Redirect on Login' for this?

2

You can try change the login component and add some script like this:

<script>
function goBack() {
    window.history.go(-2);
}
</script>

but y dont know if this apply in all your cases after login. In joomla, if you click in some content "registered" you automatticaly redirect to login. After Login you automattically redirect to your registered content.

I'm not sure if I could answer your question. Perhaps you could give some more details on the whole process you are trying to do.

  • The whole process is as follows: 1. A Menu Item is created [Menu Item Type 'Login Form' under Users Manager]. 2. If you access the link [say site.local/login], it shows the login form. Once you login, it redirects back either to the Redirect Link set or to the profile page if nothing is set in Redirect URL. I think one way this might work is, to add a cookie onClick of the login link with the detail of the page the user clicked from and when a user successfully logs in; redirect them to the page and delete that cookie. Or simple use the code you provided without cookies. – sifu Aug 27 '15 at 19:46
  • That kind of works @Max even though it briefly shows the default redirected page. But I suppose I could put a 'Redirect to previous page' or some sort of message. – sifu Aug 27 '15 at 20:16
  • Ok, understand. But why you dont use the redirect login url option to specific page profile? You can set the url redirect in Menu item Login. You try this optin in Menu item? You can try this too: <a href="javascript:history.go(-1)">Previus page</a> – Max Aug 27 '15 at 20:19
  • The requirement is that if someone clicks a link from /new-books, they need to be returned back to /new-books after login and not /user/profile. If I set a URL redirect, I can set it on only one URL. Putting a link is an option as well but not sure if the requirement allow it. – sifu Aug 27 '15 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.