I am using Opencart 3.0.8
I would like only registered users to read our blog and certain information pages. How do I make this happen?
Standard blog or Information pages have no permission settings. There is also no permission settings in Customer groups or Settings.
Please advise.
You can't restrict pages by customer group in a default OpenCart installation, so you'd need an extension. I have on called Block Products and Pages that lets you do that. You can limit pages based on URL and a variety of other rules, including customer group.
Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any questions.
Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any questions.
Code: Select all
if ($this->customer->isLogged()) {
// User is logged in, show the content
} else {
$this->response->redirect($this->url->link('account/login', '', true));
}
If you are interested in discussing your web development needs with me, please feel free to contact me at
soh.bheng@gmail.com
Bro, if you insert your code into template/blog/blog.twig - it just producers ERROR 500SohBH wrote: ↑Sat Sep 02, 2023 11:35 pmCode: Select all
if ($this->customer->isLogged()) { // User is logged in, show the content } else { $this->response->redirect($this->url->link('account/login', '', true)); }
Why would you insert PHP code into a Twig file? There is php file in controller.
If you are interested in discussing your web development needs with me, please feel free to contact me at
soh.bheng@gmail.com
Thanks, bro! Your code worked in php file.
Just need to add it after a line: public function index() {
Just need to add it after a line: public function index() {
Who is online
Users browsing this forum: No registered users and 2 guests