Support

Display User Details

ppSD2 Product Manual » Integration » Display User Details

The following allows you to detect whether a user is logged in, and if so display information about the user's account. Note that this code should only be used on pages outside of the ppSD2 template system and custom actions system.

Update your Path

Open the "member_cp/user_data.php" file and edit the "$FSP" variable to reflect the absolute path to the ppSD2 directory on your server:

$FSP = "/full/server/path/to/ppSD2";

Required Code

Note: This code will only work if you use it on a ".php" file.

At the top of your file, add this code:

<?php
include "/full/server/path/to/ppSD2/member_cp/user_data.php";
?>

Checking for a login session

<?php
if ($logged_in == "1") {
  // The user is logged into his/her ppSD2 account
} else {
  // The user is not currently logged in
}
?>

Displaying Account Information

You can display account information as follows:

<?php
echo $user[field_name_here];
?>

All of the user's information is stored in an array named "$user". By calling on that array you can display any piece of information as long as the field_name_here matches the exact field name as stored in the ppSD2 database.

Special Information Available

Basic Account Fields

<?php
echo "Username: $user[username]";
echo "E-Mail: $user[email]";
echo "Join Date: $user[joined]";
echo "Expiration Date: $user[expires]";
echo "Last Login Date: $user[last_login]";
?>

Secure Area List

<?php
echo $user_areas;
?>

Days of Access Remaining

<?php
echo $days_remaining;
?>

Current Date

<?php
echo $current_date;
?>

Last updated on 7 July 2011 5:44am

Discussion

No comments found.

Post a Comment

Please note that only comments involving constructive ideas will be approved.

This website does the Banana Dance!