Page 1 of 1

[MOD] Protected information page

Posted: Fri Mar 04, 2011 5:37 am
by VotreEspace
Simple : informations pages that will be readable only if logged

to make an information page protected, I've decided to go the easy way :
make the sort order of the page negative (like -2)

then open catalog/controller/information/information.php

find this line (~ #23):

Code: Select all

$information_info = $this->model_catalog_information->getInformation($information_id);
then, ad after it :

Code: Select all

/************** if sort_order is netative and user is not logged, we redirect him to be logged *********/
if (!$this->customer->isLogged() && ($information_info['sort_order'] <0)) {
	$this->session->data['redirect'] = HTTPS_SERVER . 'index.php?route='.$this->request->get['route'];
	if (isset($this->request->get['information_id'])) {
		$this->session->data['redirect'] = $this->session->data['redirect'].'&information_id='.$this->request->get['information_id'];
	}
	  
	  $this->redirect(HTTPS_SERVER . 'index.php?route=account/login');
} 
/**************** end mod ************/
and that's it...

still in the information menu, but you'll be redirect to login...

Re: [MOD] Protected information page

Posted: Mon Mar 07, 2011 7:18 pm
by tim21701
in 1.4.9.3 - not working

Re: [MOD] Protected information page

Posted: Sat Mar 12, 2011 8:22 am
by mystifier
It works fine with 1.4.9.3!

I would make a couple of small suggestions though: '<0' should be replaced with '<-1' because a sort order of -1 is already used to exclude Information Pages from the Information sidebox, and the Information sort order of the information box should use abs(sort_order) otherwise all restricted pages have to appear at the top.

Re: [MOD] Protected information page

Posted: Sun Mar 13, 2011 3:17 am
by peteVA
Actually, after playing with this some, I found that using the < always placed the page link at the top of the Information block, and I have one page that I specifically want to always be #1.

So I changed the <-1 to >10 and numbered the pages I wanted to have them log in for as 11 and above. Seems to work just fine.