Skip to content

Instantly share code, notes, and snippets.

Created December 15, 2009 17:38
Show Gist options
  • Save anonymous/257107 to your computer and use it in GitHub Desktop.
Save anonymous/257107 to your computer and use it in GitHub Desktop.
function content_moderation_views_api() {
return array('api' => 2.0);
}
----
function content_moderation_views_data() {
$data = array();
$data['content_moderation']['table']['group'] = t('Node');
$data['content_moderation']['table']['title'] = 'Pending revisions';
$data['content_moderation']['table']['join'] = array(
'left_table' => 'node_revisions',
'left_field' => 'nid',
'field' => 'nid');
$data['content_moderation']['table']['title'] = 'Pending revisions';
$data['content_moderation']['pending_revisions'] = array(
'real field' => 'nid',
'title' => t('Pending revisions'),
'help' => t('Check for pending revisions'),
'filter' => array(
'handler' => 'content_moderation_handler_filter_pending_revision',
),
);
return $data;
}
function content_moderation_views_handlers() {
return array(
'handlers' => array(
'content_moderation_handler_filter_pending_revision' => array(
'parent' => 'views_handler_filter'
)
)
);
}
--
class views_handler_filter extends content_moderation_handler_filter_pending_revision {
function admin_summary() { }
function operator_form() { }
function query() {
//$table = $this->ensure_my_table();
//$this->query->add_where($this->options['group'], "$table.status <> 0 OR ($table.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0) OR ***ADMINISTER_NODES*** = 1");
}
}
$data['content_moderation']['table']['join'] = array(
'field' => 'nid',
'left_table' => 'node_revisions',
'left_field' => 'nid',
'type' => 'inner',
'extras' => array(
array(
'field' => 'vid',
'operator' => '<',
'numeric' => true,
'value' => $VID)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment