revv83 Posted November 24, 2015 Share Posted November 24, 2015 Hello. I've following problem. I need to require login when user goes to one cms page. I just added in CmsController.php such code:if (!$this->context->customer->isLogged() && $id_cms == 6) { Tools::redirect('index.php?controller=authentication?back=index.php'); } But how can I change ?back=index.php reference to my own link? I was trying to insert here path to cms page but it's not working. I want to redirect user back to this cms page after login. Please help. Thanks in advance. Link to comment Share on other sites More sharing options...
herve25 Posted November 24, 2015 Share Posted November 24, 2015 Hello you can try the folowing code if (!$this->context->customer->isLogged() && $id_cms == 6) { $cms = new Cms($id_cms , $this->context->language->id); $cmsLink = $this->context->link->getCMSLink($cms); Tools::redirect('index.php?controller=authentication?back='.$cmsLink); } Link to comment Share on other sites More sharing options...
revv83 Posted November 24, 2015 Author Share Posted November 24, 2015 Thanks for help. It started to work when I use urlencode on $cmsLink: urlencode($cmsLink) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now