Discussion:
[TYPO3] FE login: redirect user if not logged in
Martin Rud
19 years ago
Permalink
Hi list,

I have a problem when a visitor tries to enter a page that is restricted
to access for only logged in FE users.

I would like to send the user to a page with a specific pid where the
visitor is told why he can?t see the page he wanted.

I haven?t found a way to do that. Can it be done?

Regards, Martin
Miroslav Monkevic
19 years ago
Permalink
Hi Martin,

look at config.typolinkLinkAccessRestrictedPages
Post by Martin Rud
Hi list,
I have a problem when a visitor tries to enter a page that is restricted
to access for only logged in FE users.
I would like to send the user to a page with a specific pid where the
visitor is told why he can?t see the page he wanted.
I haven?t found a way to do that. Can it be done?
Regards, Martin
--
Miroslav
Martin Rud
19 years ago
Permalink
Hi,

It does not work for me.

What I mean is: If page with uid = 123 i restricted, and a not logged in
visitor tries to go into www.mydomain.com/index.php?id=123 then I want
the visitor sent to www.mydomain.com/index.php?id=1 (a page with a login
form).

Regards, Martin
...
-------------- next part --------------
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.5/303 - Release Date: 06-04-2006
Miroslav Monkevic
19 years ago
Permalink
OK. It works like this:


If user types restricted URL (www.mydomain.com/index.php?id=123) into
the address box he obviously will land on the nearest (grand)parent of
the restricted page, where he (user) has sufficient access rights.

config.typolinkLinkAccessRestrictedPages can not help you here


Now, if there is:

a) link on your site which points to page with ID = 123
b) config.typolinkLinkAccessRestrictedPages is configured like:
config.typolinkLinkAccessRestrictedPages = 1
config.typolinkLinkAccessRestrictedPages_addParams =
&tx_srfeuserregister_pi1[backURL]=###RETURN_URL###&redirect_url=###RETURN_URL###

c) user is not logged in and therefore has no rights to access 123

Then:
Link to 123 page will automatically become not <a
href="index.php?id=123">Go to 123</a>, but (<a
href="index.php?id=1&tx_srfeuserregister_pi1[backURL]=index.php?id=123&redirect_url=index.php?id=123
">Go to 123</a>)


That's it! It is easy as 123. :)

P.S. if you are using realurl, beware of bug 3078, which prevents
###RETURN_URL### from being set properly.

Good luck.
Post by Martin Rud
Hi,
It does not work for me.
What I mean is: If page with uid = 123 i restricted, and a not logged in
visitor tries to go into www.mydomain.com/index.php?id=123 then I want
the visitor sent to www.mydomain.com/index.php?id=1 (a page with a login
form).
Regards, Martin
Post by Miroslav Monkevic
Hi Martin,
look at config.typolinkLinkAccessRestrictedPages
--
Miroslav
Martin Rud
19 years ago
Permalink
Hi Miroslav,

Thanks for your explination (it works for me just as you describe).

But, unfortunately I seek the first solution you mention (the one that
typolinkLinkAccessRestrictedPages can?t help me with)...

Is there no other way to do it?

Regards, Martin
...
-------------- next part --------------
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.5/303 - Release Date: 06-04-2006
Miroslav Monkevic
19 years ago
Permalink
TS conditions - is the first thing that comes to my mind.
Try something like [loginUser = *] AND [globalVar = TSFE:page|fe_group >
0, TSFE:page|fe_group = -2]
Post by Martin Rud
Hi Miroslav,
Thanks for your explination (it works for me just as you describe).
But, unfortunately I seek the first solution you mention (the one that
typolinkLinkAccessRestrictedPages can?t help me with)...
Is there no other way to do it?
Regards, Martin
--
Miroslav
Martin Rud
19 years ago
Permalink
Seems like a good idea. How do I write the code thats _makes_ the redirect?

Regards, Martin
...
-------------- next part --------------
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.5/303 - Release Date: 06-04-2006
Martin Rud
19 years ago
Permalink
Hi list,

I found the solution in another thread. I remove the restriction and
place this in setup for the page to be restricted:

[usergroup = 1]

TS for menus, & logout etc...the normal stuff a user wants to see!

[else]

page.config.additionalHeaders = Location:
http://www.yourdomain.org/somepage.html

[end]
...
Joerg Wagner
17 years ago
Permalink
Another solution is the extension Login Status Redirect
(loginstatusredirect).

It allows you to place a plugin on a page which will redirect the user
to another page, based on whether or not the user is logged in.

Simple and straightforward to use. Just install and then add the plugin
to any page you want and edit the params, which are easy to understand.

--
Greets,
JW
...
Loading...