Difference between revisions of "Moderation Functions"
m (wikified - no change in content) |
|||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | First note that there are limitations in the current Geeklog codebase that | + | First note that there are limitations in the current Geeklog codebase that will force you to name your plugin tables used for submission in a specific manner. All moderated Geeklog items such as stories and links are comprised of two tables. The first is a main table where all visible items are stored. The second is a submission table where submitted user items sit until an administrator approves them. When approved the item is moved from the submission table to the main |
− | will force you to name your plugin tables used | + | table. So for example, if you are writing a book review plugin that allows users to submit book reviews then we will pick <tt>bookreviews</tt> for your main table (this '''must''' also be your plugin name you pick) and then your submission table '''must''' be named <tt>bookreviewssubmission</tt>. |
− | specific manner. | ||
− | links are comprised of two tables. | ||
− | all visible items are stored. | ||
− | submitted user items sit until an administrator approves them. | ||
− | approved the item is moved from the submission table to the main | ||
− | table. | ||
− | that | ||
− | for your main table | ||
− | then your submission table | ||
− | |||
− | |||
− | |||
− | must be named | ||
− | If you want your plugin to be moderated like Geeklog stories | + | Why force the names? Because in the Geeklog code the submission table for all stories is coded as <tt><main name>submission</tt>. So since we picked |
− | and links then you must implement these functions | + | <tt>bookreviews</tt> for our main table (and plugin name) the submission table |
+ | must be named <tt>bookreviewssubmission</tt>. | ||
+ | |||
+ | If you want your plugin to be moderated like Geeklog stories and links then you must implement these functions: | ||
<table cellpadding="2" cellspacing="2" border="1" width="90%" align="center"> | <table cellpadding="2" cellspacing="2" border="1" width="90%" align="center"> | ||
Line 45: | Line 35: | ||
<tr> | <tr> | ||
<td valign="top" class="codeheader">plugin_moderationvalues_<plugin name></td> | <td valign="top" class="codeheader">plugin_moderationvalues_<plugin name></td> | ||
− | <td valign="top" class="code">Returns the primary key column name, the main | + | <td valign="top" class="code">Returns the primary key column name, the main table name (called <plugin name>) and the list of fields from that table that you'd like to have show up on the moderation page.</td> |
− | |||
− | |||
</tr> | </tr> | ||
</table> | </table> | ||
+ | |||
[[Category:Plugin Development]] | [[Category:Plugin Development]] |
Latest revision as of 18:20, 18 May 2009
First note that there are limitations in the current Geeklog codebase that will force you to name your plugin tables used for submission in a specific manner. All moderated Geeklog items such as stories and links are comprised of two tables. The first is a main table where all visible items are stored. The second is a submission table where submitted user items sit until an administrator approves them. When approved the item is moved from the submission table to the main table. So for example, if you are writing a book review plugin that allows users to submit book reviews then we will pick bookreviews for your main table (this must also be your plugin name you pick) and then your submission table must be named bookreviewssubmission.
Why force the names? Because in the Geeklog code the submission table for all stories is coded as <main name>submission. So since we picked bookreviews for our main table (and plugin name) the submission table must be named bookreviewssubmission.
If you want your plugin to be moderated like Geeklog stories and links then you must implement these functions:
Function | Description of Function |
---|---|
plugin_submit_<plugin name> | Shows the submission form for your plugin. |
plugin_itemlist_<plugin name> | Shows any items needing moderation for your plugin on moderation.php |
plugin_savesubmission_<plugin name> | Saves submitted item from a user in <plugin name>submission table |
plugin_moderationdelete_<plugin name> | Takes an ID into <plugin name>submission table and deletes it |
plugin_moderationapprove_<plugin name> | Takes an ID into <plugin name>submission and moves it to the main table called <plugin name> |
plugin_moderationvalues_<plugin name> | Returns the primary key column name, the main table name (called <plugin name>) and the list of fields from that table that you'd like to have show up on the moderation page. |