Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Subzero-mb Posted May 26, 2015 Posted May 26, 2015 I am trying ipb 4 since a couple of days and it looks incredible. Right now I am using in my production site ipb 3 and I have many custom scripts between forum and my website. What I would like to ask you it is regarding how can I get the information in my website of the user who is logged in the ipb4 forum.With IPB 3 it is pretty easy, you just include initdata.php and ipsRegistry.php and then you can have a complete array with member data (username, email, birthdate, avatar...)<?php require SERVER_ROOT . 'public_html/forum/initdata.php'; require FORUM_CORE . 'sources/base/ipsRegistry.php'; $registry = ipsRegistry::instance(); $registry->init(); $user_data = $registry->member()->fetchMemberData(); print_r($user_data); ?> But I am trying to do the same for the IPB4 forum but it is not working. According to this document: http://community.invisionpower.com/4docs/advanced-usage/development/single-sign-on-sso-r98/ this code should work:<?php /* Require the init.php file from the Community Suite root directory */ require FORUM_ROOT . '/init.php'; /* Initiate the session to verify who this user is */ \IPS\Session\Front::init(); /* Print the user's name */ print \IPS\Member::loggedIn()->name; ?> But it is not working for me, I have no idea why but when I access to the php url the browser shows HTTP 500 error. Can anyone help me? Thank you very much
Daniel F Posted May 26, 2015 Posted May 26, 2015 <?php /* Require the init.php file from the Community Suite root directory */ require FORUM_ROOT . '/init.php'; /* Initiate the session to verify who this user is */ \IPS\Session\Front::i(); /* Print the user's name */ print \IPS\Member::loggedIn()->name; There was a typo in the documentation. It's \IPS\Session\Front::i(); instead of \IPS\Session\Front::init();
Subzero-mb Posted May 26, 2015 Author Posted May 26, 2015 Yes, it is that! Now it is working, thank you @Daniel F
Recommended Posts
Archived
This topic is now archived and is closed to further replies.