Jump to content

Loading member


Niko Belger
 Share

Go to solution Solved by Ryan Ashbrook,

Recommended Posts

 

Hello,

I'm trying to fetch the current logged in member with

  $member = \IPS\Member::loggedIn();

However, I always get the following exception (regardless if logged in or not)

'LOCATION_UNKNOWN' in /forum/system/Session/Session.php:60 Stack trace: #0 /forum/system/Member/Member.php(145): IPS\_Session::i() #1 /forum/hwid/API/API.php(14): IPS\_Member::loggedIn() #2 {main}

 

any suggestions?

 

Link to comment
Share on other sites

You need to provide a bit more context.  

Based on that error, it appears this is a script outside the IPS framework...If that's the case, it doesn't know if you're on the front end or AdminCP.  

/* Require the init.php file from the Community Suite root directory */
require '/path/to/suite/init.php';

/* Initiate the session to verify who this user is */
\IPS\Session\Front::i();

$member = \IPS\Member::loggedIn();
Link to comment
Share on other sites

I use the same way in another script, however there I do not get anny error. What exactly do you mean by running outisde the framework

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

require_once('/srv/public_html/forum/init.php');

//Check permissions
\IPS\Session\Front::i();

try {
  $member = \IPS\Member::loggedIn();
} catch(  \RuntimeException $ex )
{
		echo $ex;
}
print_r($member);

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...