Jump to content

Getting ipb user info from php script


sk8er_boi

Recommended Posts

Can you clarify, you want to put PHP-code into theme templates? If so, you can use this construction:

{{if \IPS\Member::loggedIn()->inGroup( 5 )}}
	This code will be displayed if user is in group with ID = 5
{{endif}}

Otherwise (in your app/plugin) you should use this:

if ( \IPS\Member::loggedIn()->inGroup( 5 ) )
{
	// This code will be displayed if user is in group with ID = 5
}
Link to comment
Share on other sites

No. I have a php script that I developed. I used IPB3SDK to check if a user can see a specific forum (means that user in a special group) and let him use the script.

Now that ipb3sdk isn't updated to ips 4, what other chances do i have to check if an user is logged to my forum and user has privileges?

 

sample code that i used

define('IPB_PATH', '');
require_once('../ipbsdk/SDKConfig.php');
$self = $_SERVER['PHP_SELF'];
$sdk = IPBSDK::instance();
$login = $sdk->getClass('login');
$member = $sdk->getClass('member');
$username = $sdk->memberData['members_display_name'];
$user_id = $sdk->memberData['member_id'];
//forum no 47 is the special forum which my VIP members can see.
$isVIP = $member->checkPermissions("view",  47);



if (isVIP==1){ 

blabla

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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