title: MODx - If not logged in, redirect to a different page
body: <p>I am in the process of building a website (via MODx), and I don't want "non-logged in" users to be able to see the <strong>home page</strong>, but instead be redirected to an "under construction" page.</p>
  
  <p>In my snippet, this is what I have so far:</p>
  
  <pre><code>&lt;?php
  if (! $modx-&gt;user-&gt;hasSessionContext($modx-&gt;context-&gt;get('key')) ) {
     $modx-&gt;sendRedirect('https://google.com');
  } else {
      return '';
  }
  </code></pre>
  
  <p>Sadly, this appears to not do anything, regardless of whether or not the user is logged in. (It apppears to be a problem with the second line, the actual redirect worked fine when I tested it)
  I am unable to figure out what is wrong, and any help is greatly appreciated!</p>
  
  <p>The snippet that is in the page is <strong>[[!notloggedin]]</strong></p>