PeoplePods Objects
PeoplePods is an object-oriented framework - all one must do to access the entire power of PeoplePods is include the PeoplePods library file into a PHP script and boot up a PeoplePod object.
require_once("peoplepods/PeoplePods.php");
$POD = new PeoplePod($params);
In almost all cases, the constructor will take one or more parameters. These parameters tell PeoplePods about the identity of the current "acting" user and what sort of permission is required to view the content offered by $POD.
| authSecret |
An encrypted string that identifies a single user in the database. Typically, this will be kept in a cookie named 'pp_auth' If a valid authSecret is passed in, $POD->isAuthenticated() will return true, and $POD->currentUser() will return a Person Object that represents, you may have guessed, the current user. |
| lockdown |
Tells PeoplePods who can access the page. The authentication status of the current user, should there be one, will be evaluated against the specified test. If the test fails, the user will be redirected to the appropriate page. Valid values for this parameter are: login - a valid user was passed into the authSecret parameter. verified - a valid user was passed into the authSecret parameter, and that user has verified the email address attached to the account. adminUser - a valid user was passed into the authSecret parameter, and the adminUser flag has been added to the account. |
|
debug |
Tells PeoplePods to turn on debug messaging. Debug messages appear in the normal web error_log. Valid values are: 0 - no debug messages 1 - trace debug messages. functions will announce what they are doing. 2 - sql debug messages. all sql statements that are executed will be logged. |
Errors
If an error occurs during the creation of a PeoplePods object, $POD->success() will return false. The last error message can be found by accessing $POD->error(). An error code may also be generated, which can be found by accessing $POD->errorCode().
101 - unable to connect to db
100 - PeoplePods can't find its configuration
These errors represent a catastrophic failure of PeoplePods to start, and the resulting $POD object will be essentially non-functioning.
Examples:
To create an authenticated PeoplePods object, include the following code. Note that if the cookie is not set, the PeoplePod will be unauthenticated, but will otherwise be completely functional. This represent the "logged out" state.
require_once("peoplepods/PeoplePods.php");
$POD = new PeoplePod(array(
'authSecret'=>$_COOKIE['pp_auth']
));
To create a page that requires a user to be logged in, include the following code. Note that if the cookie is not set, the page will halt execution and redirect to the default PeoplePods login page.
require_once("peoplepods/PeoplePods.php");
$POD = new PeoplePod(array(
'authSecret'=>$_COOKIE['pp_auth'],
'lockdown'=>'login'
));
More about this function and it's related functions:
- $POD->currentUser()
- $POD->getPerson()
- $POD->getPeople()
- $POD->changeActor()
- $POD->getContent()
- $POD->getContents()
- $POD->getGroup()
- $POD->getGroups()
- $POD->getComment()
- $POD->getComments()
- $POD->header()
- $POD->footer()
- $POD->output()
- $POD->siteName()
- $POD->siteRoot()
- $POD->podRoot()
- $POD->currentTheme()
- $POD->templateDir()
- $POD->getFiles()
- $POD->getFile()
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 | 20 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.