I am planning to port this to 7, but if anyone wants to make my life easier instead and post a patch to do this, I wouldn't mind at all.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gnassar’s picture

7.x-1.x (DRUPAL-7--1) branch made in CVS.

Feng-Shui’s picture

Evening,

I've got a patch together that seems to be working in D7. Haven't done a lot of testing yet, will do so tomorrow but thought I'd post what I've got so far.

This is my first contributed patch, I've followed the documentation for patches as far as I know, but would appreciate any tips on Drupal patch etiquette :)

Cheers

Feng-Shui’s picture

Rolled that from the wrong directory, new version attached.

citronica’s picture

Will Views PHP do the job? It's the successor to Views Custom Field, and it adds a "Global: PHP" option to the list of filter criteria, with a textarea to add your custom PHP.

joelstein’s picture

Thanks for pointing out Views PHP! It works slightly differently, as far as filters go, but I was able to re-work my view with different logic, and it worked great.

meabbasi’s picture

Subscribing.

gnassar’s picture

Status: Active » Needs review

Bumping this up to "needs review," so folks check out the patch. Hopefully we can get at least a 7.x-1.x out really soon.

Seems like a bunch of people are having trouble with the filter part of Views PHP (man, talk about an inconvenient naming situation), so Views PHP Filter ported to 7.x will probably help folks out a good deal.

mgifford’s picture

Ok, I've looked at the patch in #3. It didn't apply nicely to the git repository so I forced it. I than ran it through coder and cleaned up a bunch of little stuff.

I've run it in D7 and it seems to work.

We need to be able to run PHP, but just though I'd remind folks about this message from Coder:

views_handler_filter_node_nid_php.inc
severity: criticalLine 54: Using eval() or drupal_eval() in your module's code could have a security risk if the PHP input provided to the function contains malicious code. (Drupal Docs)

I do think it's good enough at this stage to put out a dev release. Certainly needs more reviews though.

Ken Hawkins’s picture

Status: Needs review » Needs work

Updated from #8 applied with three whitespace errors:

views-php-filter-1020600-8.patch:43: trailing whitespace.
    } 
views-php-filter-1020600-8.patch:64: trailing whitespace.
        } 
views-php-filter-1020600-8.patch:91: trailing whitespace.
      } 

More strangely, this simply wasn't executing or using the comma separated list of values for us.

It seems that "function _parse_input($rawcode)" wasn't executing at all and I wasn't able to find any documentation on how it ought to be called.

A hack fix was to move the code from _parse_input into "function query" and changing $rawcode references to $this->value and applying other minor updates (like removing returns and reworking the else-if logic a little.

Working with Drupal 7.17 and Views 3.5.

qasimzee’s picture

mgifford’s picture

At this point it would be good to consolidate D7 modules if they haven't already been upgraded.

How do the features compare?

James Marks’s picture

If there is a working D7 dev version of this module, can it be posted as such? That would make it easier to compare against Views PHP (which is in dev with a development status of 'Maintenance fixes only').