Records
Blog's data are Omeka records, read with Omeka's usual functions (get_record_by_id('BlogPost', 3), get_records('BlogPost', ['live' => 1], 5), get_db()->getTable('BlogPost')):
| Record | Table | Fields |
|---|---|---|
BlogPost |
blog_posts |
title, slug (unique), excerpt, content (HTML), status (draft, pending, published), author_id (a user), category_id, featured_file_id (a file), featured_image_url, published_at, added, modified |
BlogCategory |
blog_categories |
name, slug (unique), description |
BlogTag |
blog_tags |
name, slug (unique); blog_post_tags links posts and tags |
BlogComment |
blog_comments |
post_id, author_name, author_email, body, status (pending, approved, spam), ip_hash (a keyed hash), user_id (when signed in), added |
blog_authors keeps each author's bio, picture address and name (kept when the user is deleted).
Dates are stored in PHP's time zone, as Omeka's own. Deleting a post deletes its comments and tag links; deleting a category leaves its posts without one; deleting a tag takes it off its posts.
Who sees what
The tables filter for the current user, so every query (yours too) shows only what they may see: visitors and keys without blog rights get live posts (published, with the time passed) and approved comments on them; Contributors also their own posts; Researchers every post; Admins and Super Users everything. On the command line and in background jobs, with no ACL loaded, everything is visible.
BlogPost methods
isLive(), isScheduled(), getPublicUrl($absolute = false), getAuthorName(), getCategory(), getTags(), getFeaturedImage($size = 'fullsize') (['url', 'alt', 'file'] or null), getDisplayDate(), setTagNames(array $names) (applied on save), wasSentForReview() (the last save turned "published" into "pending"). record_url($post) is its public address; metadata($post, 'author_name') and metadata($post, 'category_name') work too.
Search parameters
Table_BlogPost: status (draft, pending, published, scheduled, live, or several), live, category, category_slug, tag (address), author, search, exclude_future, slug, id; sorting with sort_field date/published, title, modified, added, status. Table_BlogComment: status, post, search, id. Table_BlogTag: slug, name, post, id. Table_BlogCategory: slug, name.
Hooks
| Hook | Arguments | When |
|---|---|---|
blog_post_published |
post |
A post goes live: when it is saved published with no future date, or on the first request after its scheduled time. |
after_save_blog_post, before_delete_blog_post… |
record, insert, post |
Omeka's own record hooks, for every save and delete (form, API, MCP). Also for blog_category, blog_tag and blog_comment. |
audit_trail_log |
action, resource_type, resource_id, detail, data |
Fired by Blog for the Audit Trail plugin: blog_post.create, .update, .submit, .publish, .delete; blog_comment.approve, .spam, .unapprove, .delete; blog_category.create, .update, .delete; blog_tag.update, .delete; blog_settings.save. |
class MyPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks = ['blog_post_published'];
public function hookBlogPostPublished($args)
{
$post = $args['post'];
// Announce $post->title at $post->getPublicUrl(true)…
}
}
Filters Blog uses
| Filter | What Blog adds |
|---|---|
public_navigation_main |
The link to /blog. |
admin_navigation_main |
Blog in the admin menu. |
api_resources |
blog_posts, blog_categories, blog_tags, blog_comments. |
search_record_types |
BlogPost ("Blog Post"). |
exhibit_layouts |
blog-posts, the Blog Posts block. |
theme_engine_share_image |
The featured image of a post page, on Theme Engine themes. |
theme_engine_share_meta |
A post's excerpt and the article type; the description of the blog home and archives (Theme Engine 0.1.2 and later). |
mcp_tools |
The five blog tools (MCP Server plugin). |
admin_dashboard_stats, admin_dashboard_panels |
The Dashboard figure and panel. |
And the hooks users_form, after_save_user and before_delete_user for author profiles.
Routes
Public (module blog, controller public): blog_index (blog), blog_post (blog/:slug), blog_preview (blog/:slug/preview), blog_category, blog_tag, blog_author, blog_feed, blog_rss, blog_atom, blog_sitemap. Admin: blog_admin, blog/:controller/:action/:id with the controllers posts, comments, categories, tags and settings.
ACL resources
Blog_Posts (privileges browse, add, edit, delete, show, publish, preview, showNotPublic, showSelfNotPublic, and Omeka's editSelf/editAll, deleteSelf/deleteAll), Blog_Comments (add, show, moderate…), Blog_Categories, Blog_Tags, Blog_Settings, Blog_Public. Super Users have every privilege and Admins inherit them; Contributors have browse, add, editSelf, showSelfNotPublic and preview on posts; Researchers showNotPublic and preview.
Settings
Options: blog_title, blog_description, blog_per_page, blog_comments_enabled, blog_comment_rate_limit, blog_comment_max_links, blog_feeds_enabled, blog_moderator_ids (JSON user IDs), blog_accent_color; and, kept by the plugin, blog_secret (signs comment forms, keys IP hashes) and blog_next_due (the next scheduled publication).
Background job
Blog_Job_Notify (in jobs.php) sends one plain-text email per recipient, with the options to, subject and body. It is started with sendLongRunning.
Tools for AI assistants
With the MCP Server plugin active, AI clients get blog_info, blog_search_posts, blog_get_post, blog_create_post and blog_update_post. They act as the signed-in user, through the same records and rules (a Contributor's "published" becomes "pending"), and follow MCP Server's publishing setting: when it keeps AI clients from making anything public, they cannot publish posts.
Theme templates
See Displaying the Blog for the templates a theme can override and their variables.