I have taken over working on a site that used the Views Custom Fields module in Drupal 6. I am upgrading this site to Drupal 7 and am trying to use Views PHP to handle this. I did not write the PHP code that is present and working fine on the Drupal 6 site and don't have the PHP/Drupal 7 knowledge to know if something needs to be changed to make it work in Drupal 7.
I have entered the code the same way it appears in the View in Drupal 6, but when I try to go to the page created by the view in Drupal 7, I'm getting the following errors:
Parse error: syntax error, unexpected '<' in mypath/sites/all/modules/views_php/plugins/views/views_php_handler_field.inc(131) : runtime-created function on line 1
Fatal error: Function name must be a string in mypath/sites/all/modules/views_php/plugins/views/views_php_handler_field.inc on line 138
The code I am trying to use was designed to return the date value for Ubercart Role Expiration Date. I'm pasting it here:
<?php
$res = db_query("SELECT expiration from {uc_roles_expirations} where uid=%d", $data->uid);
$obj = db_fetch_object($res);
if(is_object($obj))
{
$date = $obj->expiration;
print date("F d,Y", $date - 1);
}
?>I don't know if the problem I'm having here is due to something wrong with the Views PHP module or if it is something wrong with the syntax of the PHP code trying to do something in Drupal 7 that won't work.
If you can assist with getting this to work, I'd definitely appreciate it. Understood fully if you can't assist if the problem does not lie with your module here. Just please let me know whatever you can about the problem. Thanks.
Comments