0

Okay so I have what I think is a weird problem. I'm using Usercake link to page as my form of user management . Everything works great and for someone who'd not to advanced in php/ db administration it's awesome. I am now attempting to change the look of a page based if a user is logged in or not.

So from this link in the forum I am attempting to change a pannel on the page if the user is logged in the first code snippet is my modified version of that i'd like to use

if (isUserLoggedIn()){
  print('
    <ul class="login">
                    <li class="left">&nbsp;</li>
                    <li>Hello
  ');
   echo $loggedInUser->username . " Good 2 c ya!" ;
   print(' </li>
            <li class="sep">|</li>
            <li id="toggle">
            <a id="open" class="open" href="#">Log In | Register</a>
            <a id="close" style="display: none;" class="close" href="#">Close Panel</a>
            </li>
            <li class="right">&nbsp;</li>
          </ul>
            </div> <!-- / top -->
    </div> <!--panel -->
 ');
}else{ ... do everything normal 
}

now I know that isUserLoggedIn() because when I am logged in the display is changed however the place where $loggedInUser->username is left empty. any reason as to why this is happening would be greatly appreciated.

Notes: I have Included 'models/config.php' in the script and have used $loggedInUser->user_id on other pages with no problem but for some reason that doesn't seem to work here either. I have also logged In and out a few times to make sure this is not working as I've read this can be a hang up for whatever reason. Also this code is inside a my_script / my_function which is included in a larger page using php require 'my_script' if that would make a difference Again anyhelp in this would be great

brendosthoughts
  • 1,683
  • 5
  • 21
  • 38

1 Answers1

0

I'd suggest confirming the require script has the correct path, and adding in $session_start() to confirm that the session is correctly started.

Following that, turn on php errors and use echos within the usercake script to confirm pages and functions are calling correctly.

Good luck

howler
  • 13
  • 4