0

I've created a page using the CMS which I do not want to be accessible by people who are not logged in. It's a download page which I want to place in the footer. But when they click on it, it should either redirect them to the log in page or continue to the download page if they are already logged in.

I can't seem to find a solution for this other than buying a plugin, which I do not want.

2
  • please share your code. – Msquare Sep 18 '20 at 10:54
  • Thank you for your comment, I have no code other than what's in the CMS. I'm fairly new to Magento – JMTDv Sep 18 '20 at 11:04
0

You will want to look into creating a custom block with Dependency Injection. This will contain some basic logic such as checking if the page id is equal to ..X , and then simply redirecting them to login page (or a page of your choice).

Alternatively there is a 3rd-party Magento 2 module available which should help you achieve what you want:

https://www.mageants.com/force-login-extension-for-magento-2.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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