The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
I have a question about this line - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: I have a question about this line (/showthread.php?tid=1138)



I have a question about this line - shoropio - 09-10-2018

Hi, I have a question about this line
PHP Code:
<?php if(isset($user) && $user->isLoggedIn()){ } ?>
is only found in the index.php of the root of the site. My question is whether I should keep that line alone there or should I incorporate it into my other custom pages?


RE: I have a question about this line - usamusa - 09-10-2018

You can use wherever you want to manipulate page content depending on wether the user is logged in or not,
Code:
<?php if(isset($user) && $user->isLoggedIn()){ ?><P>You are logged in</p>
<?php }else{ ?>
<p>Not logged in</p>
<?php }?>

or to manage access to pages. I usually use the admin dashboard for that though.
It's very flexible really, but The only lines that you have to include in custom pages are:


Code:
<?php require_once 'PATH/TO/init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>