I needed to be able to use views to only show un-protected nodes, so I added the following at the end of my protected_nodes.module. No idea how to contribute properly so I'll just post here. Contact me if you need me to do anything else to contribute this patch into your module...

function protected_node_views_tables() {
  $tables["protected_nodes"] = array(
    "name"     => "protected_nodes",
    "join"     => array(
      "left" => array(
        "table" => "node",
        "field" => "nid"
      ),
      "right" => array(
        "table" => "protected_nodes",
        "field" => "nid"
      )
    ),
    "filters"  => array(
      "passwd" => array(
        "field"     => "passwd",
        "name"      => t("Protected: Only show nodes that"),
        'operator'  => array('IS NOT' => t('Are'), 'IS' => t('Are Not')),
        'help'      => t('Filter in/out nodes protected with passwords.'),
        'handler'   => 'views_handler_filter_null',
        'value'     => _protected_node_hidden_form(NULL, t('protected.'))
      )
    )
  );
  return $tables;
}

// copied from bio: bio_views.inc
function _protected_node_hidden_form($value, $markup) {
  $form['text'] = array (
    '#type' => 'markup',
    '#value' => $markup,
  );
  $form['value'] = array (
      '#type' => 'value',
      '#value' => $value,
  );
  
  return $form;
}

Great module by the way!

Comments

mtolmacs’s picture

Thanks! I'll check it out soon and if everything is fine, I'll commit it.

mtolmacs’s picture

Status: Needs review » Fixed

Integrated to the latest DRUPAL5 branch.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.