Hi guys,
I was wondering if there's a way that i could make some information pages restricted to members only?
Easy to do. Just set up an isLogged check on the page you want it and it will redirect anyone to login if they try and view it. Thing is, the information pages are displayed from an array so you would have to use a conditional before hand.
v1.5.2.1+
So lets see open catalog/controller/information/information.php and find this:
Just under it add this:
This checks for an information ID of 1. If they are not logged it will make them login, then redirect them to the information page they were trying to view. To find the info id's just turn your SEO url off and navigate to the info page you want. Look at the browser bar to see the ID in the URL. Tested and works
v1.5.2.1+
So lets see open catalog/controller/information/information.php and find this:
Code: Select all
if (isset($this->request->get['information_id'])) {
$information_id = $this->request->get['information_id'];
} else {
$information_id = 0;
}
Code: Select all
if($information_id == 1){
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = $this->url->link('information/information', 'information_id=' . $information_id);
$this->redirect($this->url->link('account/login', '', 'SSL'));
}
}
Easy to do as well. You need only to set the error session and it will display on the login page once they get to it. For example:
And now open up account/login.php and add this code the public function index()
Code: Select all
if($information_id == 1){
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = $this->url->link('information/information', 'information_id=' . $information_id);
$this->session->data['error'] = "You must login!";
$this->redirect($this->url->link('account/login', '', 'SSL'));
}
}
Code: Select all
if (isset($this->session->data['error'])) {
$this->data['warning'] = $this->session->data['error'];
unset($this->session->data['error']);
} else {
$this->data['warning'] = '';
}
Who is online
Users browsing this forum: No registered users and 28 guests