Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>this is untested, but should point you in the right direction:</p> <p>(OpenCart 1.4.9.x)</p> <p>Save this to: catalog/controller/common/check_login.php</p> <pre><code>&lt;?php class ControllerCommonCheckLogin extends Controller { public function index() { if (!$this-&gt;customer-&gt;isLogged()) { // Require to be logged in $ignore = array( 'account', 'payment' ); $match = false; if (isset($this-&gt;request-&gt;get['route'])) { foreach ($ignore as $i) { if (strpos($this-&gt;request-&gt;get['route'], $i) !== false) { $match = true; break; } } } // Show site if logged in as admin $this-&gt;load-&gt;library('user'); $this-&gt;registry-&gt;set('user', new User($this-&gt;registry)); if (!$this-&gt;user-&gt;isLogged() &amp;&amp; !$match) { return $this-&gt;forward('account/login'); } } } } ?&gt; </code></pre> <p>Edit /index.php</p> <p>Find:</p> <pre><code>// Maintenance Mode $controller-&gt;addPreAction(new Action('common/maintenance/check')); </code></pre> <p>Add After:</p> <pre><code>// Login Check $controller-&gt;addPreAction(new Action('common/check_login')); </code></pre> <p>Essentially use the same logic as the maintenence check... The big difference is it looks for the word 'account' in the string... If it finds it it allows the page to be displayed, if not it redirects to the login page...</p> <p>Use the word "account" instead of "login" in case they need to register... All of the account pages already check for loggin so there is no worry there...</p> <p>Again, untested so you may need to tweak one or two things - but it should/may work by dropping in the code</p> <hr> <p>check_login.php for opencart 1.5.3</p> <pre><code>&lt;?php class ControllerCommonCheckLogin extends Controller { public function index() { // Require to be logged in if (!$this-&gt;customer-&gt;isLogged()) { // Require to be logged in $ignore = array( 'account','payment' ); $match = false; if (isset($this-&gt;request-&gt;get['route'])) { foreach ($ignore as $i) { if (strpos($this-&gt;request-&gt;get['route'], $i) !== false) { $match = true; break; } } } // Show site if logged in as admin $this-&gt;load-&gt;library('user'); $this-&gt;user = new User($this-&gt;registry); if (!$this-&gt;user-&gt;isLogged() &amp;&amp; !$match) { $this-&gt;redirect($this-&gt;url-&gt;link('account/login')); } } } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload