I created following URL (that I am sending via email to the user):

$form->data['redirect_url'] = urlencode(base64_encode("http://www.domain.it/" . $form->data['link_form'] . "?id_risposta=" . $form->data['id_risposta']));

$form->data['link_modifica_bozza'] = "http://www.domain.it/component/users/?view=login&return=" . $form->data['redirect_url'];

This means that after login the user will be redirect to "redirect_url".

The problem is that if the user is already logged in, it is stacked in profile page, and it is not redirect to "redirect_url" automatically.

Is there any way to add an automatic redirect directly in the URL if the user is already logged in?

Like a conditional URL...

Thank you!

1 Answer 1


I had a similar problem, and I have solved it as follows:

  1. In Joomla, you can create a Menu with Access "Registered",

  2. When you send a link with this Menu, the user will automatically gets a login page and redirected afterwards to this site.

Btw, if you need to show that menu, you can create a hidden menu first (with "registered" access), and add an "Menu Item Alias" (System Links) to this hidden menu. You can test it on my site with e.g. https://www.loytec.com/support-en/rma

When the user is not logged in, the standard log-in process is shown; if the user is already logged-in, it directs to the menu.

  • Unfortunately for me it is not a static URL...
    – Enzo Orsi
    Commented Dec 17, 2016 at 23:27
  • I mean, it is a very good idea, but I am creating a dynamic link and I send it via email (e.g. url.com?par=1). I need the user logged in and then redirected to that dynamic link... Any idea?
    – Enzo Orsi
    Commented Dec 17, 2016 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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