I'm having trouble getting the Parent Node FILTER to work properly.

  1. The selection list it offers is a list of NIDs when node titles would be much more helpful.
  2. Also I get Drupal errors when I submit a view where this Filter is Exposed ... something about expecting a string ...

I've been tinkering with the code in relativity_views.inc for 2 days without any success. I think it's in the last function here:

<?php

function views_handler_filter_relativity_parent_zero() {
  $parents = array();
  $result = db_query("SELECT DISTINCT parent_nid FROM {relativity} ORDER BY parent_nid");
  while ($obj = db_fetch_object($result)) {
    $parents[$obj->parent_nid] = "$obj->parent_nid";
//    $parents[$obj->parent_nid] = "$obj->title";  // my best guess didn't work :(
  }
  return $parents;
}

?>

Can anyone help ?

CommentFileSizeAuthor
#4 rel.patch2.06 KBdarius
#1 relativity_views_1.patch478 bytesowahab

Comments

owahab’s picture

Status: Active » Needs review
StatusFileSize
new478 bytes

JohnG, I think you could've dropped me an e-mail ;)
As usual: please test before you use it in a production environment.

JohnG-1’s picture

Status: Needs review » Reviewed & tested by the community

+1 Omar what can I say? you make it look so easy ;) ... 2 days worth of sincere thanks.

Quick test showed no problems. I've marked as ready for commit if that's OK with Darius && no-one can see any problems. (I did wonder if the change would interfere with the Parent Title argument function but as far as I can tell they are completely separate.)

Off Topic : I guess this filter is going to be of limited use when exposed anyway, as it returns a list of every node with a parent ID in the relativity table ... that's going to get quite busy ;) I was trying to figure a way to filter the selection list items before they appear as an exposed filter ... filter by type for example ... but AFAIK Views currently doesn't support this. My favourite idea was to enable a Filter by View, which references another view for it's data rather than a database table ... ;)

JohnG-1’s picture

bump ;)

darius’s picture

StatusFileSize
new2.06 KB

Committed to CVS head. I could not replicate the error. The patch adds the node title to the listing of node IDs.

darius’s picture

Status: Reviewed & tested by the community » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)