Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt November 11, 2024
Alex914 Posted November 18, 2014 Posted November 18, 2014 Hello,How get the user information (username, group...) on an external site?Like IPS3require_once( './initdata.php' ); require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/ require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/ $registry = ipsRegistry::instance(); $registry->init(); // Fetch details $member = $registry->member()->fetchMemberData(); // Print the display //print_r($registry->member()->fetchMemberData()); print $member['members_display_name']; //print $member['member_id'];Thanks
Ryan Ashbrook Posted November 18, 2014 Posted November 18, 2014 <?php // Initialize IPS4 Framework require_once( './init.php' ); // Indicate that we should consider this a front-end session so we can obtain the currently logged in users information. \IPS\Session\Front::i(); // Grab the currently Logged In user. $member = \IPS\Member::loggedIn(); // Output their username print $member->name;
Alex914 Posted February 7, 2015 Author Posted February 7, 2015 Hello, The API does not work (4.0.0 Beta 7a) 1) I create demo file (demo.php) in my server and load IPS. <?php // Initialize IPS4 Framework require_once( 'forums/init.php' ); // Indicate that we should consider this a front-end session so we can obtain the currently logged in users information. \IPS\Session\Front::i(); // Grab the currently Logged In user. $member = \IPS\Member::loggedIn(); print_r($member); // Group 2 = Guests if ($member->member_group_id == 2) { echo 'Guests'; } else { echo '<br><br>'; echo 'Hello '; echo $member->name; } 2) I'am logged on my board 3) On my demo.php page, no logged IPS\Member Object ( [_followData] => [_group] => [restrictions:protected] => [modPermissions:protected] => [calculatedLanguageId:protected] => [markers] => Array ( ) [markersResetTimes:protected] => Array ( ) [previousName:protected] => [sessionData:protected] => [_lang:protected] => [_url:protected] => [profileFields] => [_reputationData:protected] => [_following:protected] => Array ( ) [reportCount:protected] => [ignorePreferences:protected] => [_data:protected] => Array ( [member_group_id] => 2 [mgroup_others] => [joined] => 1423276886 [ip_address] => 85.XX [timezone] => UTC [allow_admin_mails] => 1 [pp_photo_type] => [member_posts] => 0 [pp_main_photo] => [pp_thumb_photo] => [failed_logins] => [pp_reputation_points] => 0 [signature] => ) [_new:protected] => 1 [changed] => Array ( [member_group_id] => 2 [mgroup_others] => [joined] => 1423276886 [ip_address] => 85.XX [timezone] => UTC [allow_admin_mails] => 1 [pp_photo_type] => [member_posts] => 0 ) [skipCloneDuplication] => )
Alex914 Posted February 7, 2015 Author Posted February 7, 2015 It work only if my demo.php file is in board directory, why ?demo.php in / = no work, no loggedrequire( 'forums/init.php' );demo.php in /forums = okrequire( 'init.php' );
Alex914 Posted February 7, 2015 Author Posted February 7, 2015 A solution? If no a bug, why doesn't it work? It works perfect with IPS3...
lilroo503 Posted February 8, 2015 Posted February 8, 2015 I just added a comment to your bug report. I do believe it is a bug, as stated in my comment. Hopefully someone on staff can take a look at it next week and can confirm or deny my thoughts on the matter.EDIT: The bug report: http://community.invisionpower.com/4bugtrack/beta-7a-api-does-not-work-r2463/
Vinlockz Posted December 3, 2015 Posted December 3, 2015 This is still not working for me. Is there a way to do this now?
Arasius Posted June 9, 2016 Posted June 9, 2016 I have the same issue here..... can't get user informations in Sessions. Any clue?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.