Download & Extend

Filter NOT working in Drupal 6

Project:Views PHP
Version:6.x-1.x-dev
Component:Filter Handler
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active

Issue Summary

I am using Views 2 dev in Drupal 6 and filtering is not working at all ;(.

I am using something like this in PHP condition in filter:

if ($row->php != "today") {
      return FALSE;
} else {
      return TRUE;
}

Today is my Global: PHP field, and when echoing it has today value for cca half of all node results.

However this condition echos all results.

I do not understand why it is not functioning.

Comments

#1

I have solved it by incuding the huge flter code from Global PHP field into filter.

Because for some reason it is not accepting the $raw->php

I think it is a bug or something.

#2

Below code doesn't work on D6, "$row->php" is my Global PHP that I what to use.

return empty($row->php);

Is it a bug?

#3

I'm pretty sure I'm seeing the same thing.

Using views_php version 6.x-1.x-dev with a date stamp of 1308745781 and views version 6.x-3.0-alpha4.

If the "Filter code:" block is empty, I get all the rows as expected.

If the "Filter code:" block contains
return TRUE:
I get nothing which is what I guess I would expect based on the description under that block
If the code returns TRUE the current row is removed from the results. Do not use < ? p h p ? > delimiters.

If the "Filter code:" block contains
return FALSE:
I still get nothing which is not what I would expect.

#4

Title:Filer NOT working in Drupal 6» Filter NOT working in Drupal 6

Tracing this further, it looks like anything in the "Filter Code:" field causes all the rows to disappear.

The code in views_php_handler_filter.inc appears to be executing correctly. I put a dpm into the code at line 126 and it outputs if I set the Filter Code to return TRUE and doesn't if I set the Filter Code to return FALSE. But no rows are output.

Remove the code in the field and the rows reappear.

So I've tried:

  1. return TRUE;
  2. return FALSE;
  3. $a=$a; (which returns NULL)

In all three cases the rows disappear.

Next I tried commenting out the code between lines 112 to 131, which effectively removes the processing of that field. Still NO rows.

With the code commented out, if I clear the Filter Code field, the rows reappear.

I'm starting to believe the field is having some side effect I don't understand. And I'm not sure where to look next. Any ideas anyone?

#5

Priority:normal» major

subscribe

Same problem - filter appears to not be working. no rows displayed whether I return TRUE or FALSE.
Hey this is a pretty old post. Is this module still under active maintenance?

This module is very cool and useful. How can I help to get this fixed?

Changing priority to major.

#6

I back pedaled to views_customfield because this module doesn't work.
I also noticed that the disable and uninstall doesn't remove the presence of views_php from views.

#7

as described in #5,
what ever is returned, it is ignored.

Any Ideas / progress on this?

#8

regarding #6 - I did back pedal and after disabling and uninstalling I also needed to clear my cache and then views_php was fully removed.

#9

Hi webservant316,

Thanks for your imput.
However I would like to stick with this module, as to many things are already made with it.

#10

I am using views 3.
Could this be the problem?

#11

I would be glad to except for these problem...

1. views_php has a filter option which I need, but the return value is currently ignored. I made a simply filter with return TRUE; and return FALSE; and in both cases behavior was return FALSE; So until this is fixed views_php has little advantage over views_customfield.

2. Further, $value, $data, and $php are not properly assigned in the field definitions either. I added this code to my views_php field definition error_log("TEST: " . print_r($value,TRUE) . print_r($php,TRUE) . print_r($data,TRUE),0); and all three variables had null values (at places) when they should have been populated. However, the $data array was properly assigned in views_customfield.

Give those major problem, php_customfield at least works for now. I will move back to views_php as soon as the above are fixed because I really do need the filter capability.

#12

Priority:major» critical

I had the same trouble with views 3. My workaround was use the hook_views_pre_render into a custom module to adjust the filter.

nobody click here