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. |
| 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:
- $Person->get()
- $Person->set()
- $Person->write()
- $Person->writeFormatted()
- $Person->htmlspecialwrite()
- $Person->addMeta()
- $Person->removeMeta()
- $Person->getMeta()
- $Person->addFlag()
- $Person->removeFlag()
- $Person->toggleFlag()
- $Person->hasFlag()
- $Person->addTag()
- $Person->removeTag()
- $Person->hasTag()
- $Person->tagsFromString()
- $Person->tagsAsString()
- $Person->success()
- $Person->error()
- $Person->errorCode()
- $Person->asArray()
- $Person->get()
More about this function and it's related functions:
- $Person->sendEmail()
- $Person->sendInvite()
- $Person->welcomeEmail()
- $Person->sendMessage()
- $Person->sendPasswordReset()
- $Person->isVerified()
- $Person->verify()
- $Person->addFavorite()
- $Person->removeFavorite()
- $Person->isFavorite()
- $Person->toggleFavorite()
- $Person->addWatch()
- $Person->removeWatch()
- $Person->toggleWatch()
- $Person->isWatched()
- $Person->addFriend()
- $Person->removeFriend()
- $Person->isFriendsWith()
- $Person->addComment()
- $Person->comments()
Download the latest version of PeoplePods!
0.9
Latest Version:
Release Notes
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...
Recently Updated Documentation
Recent Posts from The Forum
I can't verify my account :(
1 comment | 21 hours ago
Jquery UI problem. I having an issue for implementing UI on my theme, all reference are ok (304) on net console. http://un1v.altervista.org/ I have...
0 comments | 5 days ago
Can anybody tell me which hosting using for PP and it working good? I tryed to much (i think good) hoster and still have no site on PP :( Tell me...
0 comments | 8 days ago


No comments have been posted yet.