$POD->registerPOD()
The registerPOD() function should be used only within the settings.php file of a plugin pod. It is used to tell PeoplePods what the pod does, what URLs it handles, and what variables and settings it needs.
$POD->registerPOD( $pod_name, $pod_description, $URL_array, $VAR_array, $path_to_methods_file, $name_of_settings_function, $name_of_install_function, $name_of_uninstall_function );
The $pod_name parameter should be a short string which matches the folder name in which the pod lives. Thus, if you have a folder called 'my_plugin/', the $pod_name parameter should be 'my_plugin'.
The $pod_description parameter is a string which should contain a description of the pod and its functions. This description is used within the PeoplePods command center.
The $URL_array parameter is an associative array which should contain mappings between URLs and handler scripts. The keys of of the array are the URL patterns, and the values of the array are the actual handler scripts. The URL patterns should be constructed as RewriteRule-friendly regular expressions, while the value should point to a php file within the pod.
$URL_array = array( '^welcome$'=>'my_plugin/handler.php', '^welcome/(.*)'=>'my_plugin/handler.php?mode=$1', '^goodbye$'=>'my_plugin/goodbye.php' );
The $VAR_array parameter should contain an associative array of key value pairs. These pairs will become static system options, accessible via the $POD->libOptions() function.
// in settings.php
$VAR_array = array(
'foo'=>'bar',
);
// in any PeoplePods script:
$val = $POD->libOptions('foo');
The primary use of this of this parameter is to modify the automatically generated permalink and editlink values for a new content type. See creating permalink patterns for more information.
The $path_to_methods_file parameter should contain the path to the methods.php file included in the pod. If no methods file is included, this parameter is not necessary.
99.99% of the time, this should be set to:
$path_to_methods = dirname(__FILE__) . "/methods.php";
The 6th parameter is the name of the settings function. This parameter is also optional. The settings function is used by the PeoplePods command center to create a settings form to collect dynamic system options.
Settings functions are described in more detail here.
The 7th parameter is the name of the install function. This parameter is also optional. The install function is called automatically when the pod is enabled.
Install functions are described in more detail here.
The 8th parameter is the name of the uninstall function. This parameter is also optional. The install function is called automatically when the pod is disabled.
Uninstall functions are described in more detail here.
With all of these variables combined, you might have a call that looks something like this:
$POD->registerPOD(
'my_post_type',
'a custom pod that sets up the "post" content type',
array(
'^posts/(.*)'=>'my_custom_pod/post_handler.php?stub=$1',
'^edit/(.*)'=>'my_custom_pod/edit_handler.php?id=$1',
),
array(
'post_document_path'=>'posts',
'post_document_editpath'=>'edit',
),
dirname(__FILE__)."/methods.php",
'postTypeSetup',
'postTypeInstall',
'postTypeUninstall'
);
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 am trying to find a way of integrating a forum, much like this one, into my site. Any help?
0 comments | 3 days ago
Hello PeoplePods forum, we want to add social networking features to our online training software. We are looking to allow users to post comments on...
0 comments | 6 weeks ago
Hello, My firt problem is whith the API, because when I open my site I find : Invalid API Key. Please visit PeoplePods.net to get a valid...
2 comments | 6 weeks ago


No comments have been posted yet.