Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Aetherdan Posted January 22, 2018 Posted January 22, 2018 // Initialize IPS4 Framework require_once('./init.php'); /* Get the currently logged in member */ $member = \IPS\Member::loggedIn(); $member_id = $member->member_id; echo $member_id; I have created a php file in my forums parent directory, with the following code. Why does it not return the member id of the logged in user?
bfarber Posted January 22, 2018 Posted January 22, 2018 Because you have not initialized a dispatcher, the session class (which is needed to determine if the member is logged in or not) does not know if this is the front end or the AdminCP. Try adding this after the require_once line: \IPS\Session\Front::i();
Recommended Posts
Archived
This topic is now archived and is closed to further replies.