This is a port of the README file within the Workbench Module. It may need to be adapted to fit the Handbook style.

Workbench Moderation does not have a mature API.

Database schema

Workbench Moderation uses three tables to track content moderation states.

  • workbench_moderation_states
    Stores administrator-configured moderation states.
  • workbench_moderation_transitions
    Stores administrator-configured transitions between moderation states. These are simply pairs of moderation states: a "from" state and a "to" state.
  • workbench_moderation_node_history
    Stores individual moderation records related to each node revision. Each record stores the nid and vid of a node, the original moderation state and the new moderation state, the uid of the user who did the moderation, and a timestamp.

Views Integration

Workbench Moderation provides Views integration so that site builders may include moderation information in node and node revision views.

  • Filters, fields, sorts, and arguments are provided for moderation record data.
  • A relationship is provided from moderation records to the user who made the moderation change.
  • A "content type is moderated" filter is provided on for nodes to help in creating lists of only moderated content.

When you add a workbench_moderation_node_history field to a content view, you get a left join to workbench_moderation_node_history. This may produce more rows than you want. There is an active issue for the join. http://drupal.org/node/1601036

When you want to see the whole history, view the history table and attach node information. When you want less, perhaps only the revision stuff, view the node_revision table. If you want only one row per node, view the node and display the published state from the node table without anything from the history table. Add examples here.

List nodes with current state

My example:

I added an Expired state to the end of the transitions. I created examples that went through to pending then back to draft with a new revision then up to published with some going through to to expired.

I created a view with one row per node displaying Published. Later I added State. Suddenly I had a row per entry in the history table because of a left join between the tables. I removed the State field and used Views PHP to add the state from the most recent history row. I am back to one row per node.

Hopefully someone will add a better way to do this example.