10-28-2017, 05:58 PM
Thanks for the quick reply, Brandin!
If I put that directly on the page (privatepage.php might be the page in my example), and I type in the path to access it directly, all of the UserSpice code works as it's intended.
But I have something like this set-up on my index page:
<pre></pre>
Because it will render privatepage.php using Twig, I can't put the PHP code you provided in directly (or at least I don't know HOW to with the Twig syntax, which might also be the problem). So, I was trying to execute it prior to the return, but I can't seem to figure out how to get that to work (or if it's possible) so that:
If user logged in, return ...->render, etc.
but If not logged in, redirect to log in.
If I put that directly on the page (privatepage.php might be the page in my example), and I type in the path to access it directly, all of the UserSpice code works as it's intended.
But I have something like this set-up on my index page:
Code:
require_once 'users/init.php';
<pre>
Code:
$app->get('/privatepage', function ($request, $response, $args) {
return $this->view->render($response, 'privatepage.php');
});
Because it will render privatepage.php using Twig, I can't put the PHP code you provided in directly (or at least I don't know HOW to with the Twig syntax, which might also be the problem). So, I was trying to execute it prior to the return, but I can't seem to figure out how to get that to work (or if it's possible) so that:
If user logged in, return ...->render, etc.
but If not logged in, redirect to log in.