Moderation Functions

From GeeklogWiki
Jump to: navigation, search

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:

Table 1. Moderation 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.