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

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("/readme/peoplepods_object/peoplepods/PeoplePods.html");
$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("/readme/peoplepods_object/peoplepods/PeoplePods.html");
$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("/readme/peoplepods_object/peoplepods/PeoplePods.html");
$POD = new PeoplePod(array(
 'authSecret'=>$_COOKIE['pp_auth'],
 'lockdown'=>'login'
));

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.7 Latest Version:
Release Notes

A free membership is required to download PeoplePods.

  Already Registered? Login

Recent Posts from Our Blog

PeoplePods powers MediaBugs.org and the Helsinki Design Lab

April saw the launch of two brand new PeoplePods-powered applications. These new sites use the latest version of PeoplePods - 0.8 - which will be available to download at the end of...

Version 0.7 Now Available

Last night, I uploaded a new release of PeoplePods: version 0.7. The most exciting new features in this version are: new dynamic image resizing options, a faster comment polling system, new ways...

Developer Preview Launch!

I am very excited to announce the launch of PeoplePods version 0.666, THE DEVELOPER PREVIEW! After tons of hacking, I have tweaked the last line of code, and I am finally ready for a wider audience...