Sometimes it requires a little PHP to get the job done in a Views filter. That’s where the Views PHP Filter module comes in. The goal when using a PHP snippet is to return an array of nids.

In this example we’re returning an array of nids where a field in a CCK content type is equal to the user’s name. This is a rare instance that we won’t go into. But the concept is the same for many other use cases.


global $user;
$nids = array();
$result = db_query("SELECT nid FROM content_type_property WHERE field_propmanager_value = '%s'", $user->name);
while ( $row = db_fetch_array($result) ) {
$nids[] = $row['nid'];
}
return $nids;