Home » Documentation » What is PeoplePods? » SDK Documentation » Object Definitions » Person Object

Person Object

Members of your site are represented within PeoplePods as Person Objects. Person Objects provide functionality to support all the basic actions a member can take like adding and managing friends, adding and managing favorites, and updating profile information.

Person Objects are stored in the users table in the database.

Person Objects should always be created through the main $POD object using the $POD->getPerson() or $POD->getPeople() functions.

Fields

id the unique identifier of this person's record in the db
nick the person's display name.
fullname the person's full name.
stub the person's tokenized, url friendly nick.
email the person's email address. this is also used as the username.
authSecret a unique encrypted string that identifies the user. Should never be modified! Use the password field to change the password.
passwordResetCode Semi-random encrypted string. Used to find a person who needs to have their password reset. This should be null unless a password reset has been initiated by the user.
lastVisit Datetime of the last time this person hit the site.
date Datetime of the last modification to this person record.
memberSince Datetime of the member's join date.
verificationKey If this field is null, the person has verified their email. Otherwise, it will contain a semi-random encrypted string. Should not be modified! Use $Person->isVerified() and $Person->verify().
invitedBy user id of the member whose invite was used to join the site.
permalink URL to the peron's onsite profile.
password Set only when you want to change a users password. Note: Setting this variable will cause the authSecret to change, so the pp_auth cookie must be reset to match this new value.
invite_code An invite code that matches a row in the invites table. This should only be specified for new users who have specified an invite code, duh!

Examples:

// write a person's nickname
$person->write('nick');

// change a person's nickname
$person->set('nick','Chester');

// change a person's password
$person->set('password','12345');

// save changes to the db.
$person->save();

Relationships

Each person has a set of predefined relationships to other people and content within the site. These relationships are represented by cleverly named functions that return stacks that can be handled like any other stack.

$Person->friends() - Returns a stack of people who the current person has added as a friend.

$Person->followers() - Returns a stack of people who have marked the current person as a friend.

$Person->favorites() - Returns a stack of content objects that the current person has added as favorite.

$Person->watched() - Returns a stack of content objects that the current person is watching.

$Person->files() - Returns a stack of file objects that the current person has uploaded.

Examples:

// display a list of the person's friends
if ($Person->friends()->count() > 0) {
    $Person->friends()->ouput('short');
}

// display a person's follower count
echo $Person->followers()->totalCount();

// Find a person's profile image
if ($img = $Person->files()->contains('file_name','img')) {
    $img->write('thumbnail');
} else {
    echo "/img/no_icon.png";
}

// Show the first page of a person's favorites
while ($docs = $Person->favorites()) {
    $docs->output('short');
}

Every person object inherits all the code i/o functions from it's parent object. These functions include:

More about this function and it's related functions:

  • Discuss This Document

No comments have been posted yet.

Download Download the latest version of PeoplePods!

0.9 Latest Version:
Release Notes

Join the PeoplePods developer network and get direct access to documentation, additional plugins, and our forums!

  Already Registered? Login

Recent Posts from Our Blog

Version 0.9 is here!

The latest version of PeoplePods is now available for download! This version features a drastically revamped theme which is now valid HTML5, a completely rewritten JSON-powered API, many...

Ben Brown on how running a community is like throwing a giant, never-ending party

An interview I did with OpenSource.com is now online!  Read it here. In it, I discuss how running an online community is like throwing a giant, never-ending party, how open source techniques...