5095 Posts in 1518 Topics by 1114 members
| Go to End | ||
| Author | Topic: | 4549 Views |
-
Re: User log-in and redirect to different page

6 August 2010 at 2:38am
Yes you can:
in security -> underneath the checkbox 'go to admin area'
it says:
'Or select a Page to redirect to'select your redirect page.
-
Re: User log-in and redirect to different page

6 August 2010 at 2:44am
Tried that, but when i select a page to redirect to the user logs in and is redirected to the frontend page i've choosen, while i want him to be redirected to that page but INSIDE the cms, so he can start editing his page as soon as he logs in. Does it make sense?
Thanks for your help
-
Re: User log-in and redirect to different page

6 August 2010 at 2:48am
Hi Balder
all you need to do is change the way the redirect link is contructed, so this bit of code:
//Get the page that is referenced in the group
$Link = DataObject::get_by_id("SiteTree", "{$Group->LinkPageID}")->URLSegment;Becomes this:
//Get the page that is referenced in the group
$Link = "admin/show/$Group->LinkPageID";Untested but that should do it ;)
Aram
www.SSbits.com - SilverStripe Tutorials, Tips and other bits
-
Re: User log-in and redirect to different page

6 August 2010 at 2:49am Last edited: 6 August 2010 2:50am
OK, i solved it thanks to this thread: http://www.silverstripe.org/general-questions/show/257647
----------------
The way to do this is to have the link be /admin/show/$ID of the page you want to redirect to. So I image you extract the Id from the TreeDropdownField and insert it into the redirector so change these lines:$Link = DataObject::get_by_id("SiteTree", "{$Group->LinkPageID}")->URLSegment;
to this:
$ID = DataObject::get_by_id("SiteTree", "{$Group->LinkPageID}")->ID;
And this line:
Director::redirect(Director::baseURL() . $Link);
to this:
Director::redirect(Director::baseURL() . "admin/show/" . $ID);
------------------------
[edit]
You were faster
And that works by the way, so thanks a lot! -
Re: User log-in and redirect to different page

6 August 2010 at 3:00am
Just one more question to clean things up: when redirecting, the browser now displays a page with the following text:
-----------------
done
Redirecting to /myurl/admin/show/86... (output started on /.../mysite/code/CustomLogin.php, line 10)
--------------And then redirects.
Is it possible not to display that page? -
Re: User log-in and redirect to different page

6 August 2010 at 3:26am
Hmm yea I have had that before, but not sure if/how you can get rid of it :s
Annoying...
-
Re: User log-in and redirect to different page

6 August 2010 at 3:43am
Well that was easy
I just deleted the following on CustomLogin.php, line 10, which i guess was a leftover from the code i copied ;)
--------------
echo 'done';
--------------
| 4549 Views | ||
| Go to Top |

