TYPO3 felogin - How to set preserveGETvars or redirect_url to actual page via Hook?

778 views Asked by At

TYPO3: v10.4.2

My issue:
I've a LoginForm in my template that is visible in the menue. I just want to be able to login wherever the user is and reload the same page.
That works quite fine with normal pages...
BUT! When we are in a NewsItem or another detail-side of any extension, it doesn't take the parameters which are mandatory to reload the same page. What leads into a Required argument "news" is not set for...

I tried to get the parameters somehow to felogin - there's that preserveGETvars - but that doesn't do anything. No idea how that works.

And my other idea was to give felogin the total uri of the actual page to redirect. There's a hook mentioned in the documentary but I have no clue about using hooks. :/

Why is it so hard to configure. I just want the ext to login and open the same page again. Isn't that quite common? :((

I hope somebody can help me.

Setup-Config: I saw that and tried it but there's no effect.

plugin.tx_felogin_login {
  settings {
    redirectMode = getpost
    preserveGETvars = tx_news[news],tx_news_pi1[news]
  }

  view {
    templateRootPaths.2 = fileadmin/templates/felogin/Templates/
    partialRootPaths.2 = fileadmin/templates/felogin/Partials/
    layoutRootPaths.2 = fileadmin/templates/felogin/Layouts/
  }
}

And I tried lot's of preserveGETvars also all

The documentation says preserveGETvars = tx_ttnews[tt_news],tx_myext[id],... - but that seams to be really old. and I tried it, doesn't work at all. :/

4

There are 4 answers

2
Jacco van der Post On

If you turn the routeEnhancer off you can see the GET parameters in the URL. For NEWS detail it could be

 tx_news_pi1[action],tx_news_pi1[controller],tx_news_pi1[news]

I also would make a condition to apply this only on the detail page.

1
user3714261 On

I had the same problem and couldn't find a way with felogin and 10LTS. So i just switched to the old mode, Settings > Configure Installation-Wide Options:

[SYS][features][felogin.extbase] = false 

I had to insert the plugin again, but then it worked instantly, without "preserveGETvars" or anything. Not the solution i want but at least it works now.

0
exotec On

Very late, but my solution was simply to url encode the ? and & signs

0
Dania Meier On

A bit late, but since the problem persists in TYPO3 v11.5 and other people might stumble upon this post.

The problem lies within the <f:form /> in the Fluid-Template and it not propagating the Queries of whatever detailpage we're currently on. Adding addQueryString="true" to the f:form has solved that problem for me. Now the URL of the action for the form on submit is correct and therefore the form itself redirects properly.

I really hope this saves someone else the nearly 3 hours of trial and error I just did.