I've used the Customfield before with PHP and its worked fine, but since upgrading to the latest version of the Drupal Core (6.15) I've been getting an Ajax error in views when trying to add php to a view.

What's particularly weird is that any php I'd added to a customfield before the upgrade seems to be working just fine, its only when I try to add new custom php fields and then try to update them that I get the following error:

"An error occurred at http://www.mysite.com/admin/build/views/ajax/config-item/myView/default/..."

Sounds like it may be an issue having to do with views Ajax previewing, and therefore might be a problem with views and not customfield at all, but I'm not sure. It happens when I try to include PHP in the markup setting as well (with PHP selected as the input filter)

Any thoughts?

Comments

dkane’s picture

Title: Ajax error when trying to add PHP » Ajax error when trying to add PHP to Views Customfield
ChrisRut’s picture

:subscribe:

dkane’s picture

So I solved this issue myself:

This ended up being an issue with the mod_security setting on my server. After contacting tech support for my server they were able to add the paths that caused the error to their mod_security rules.

The annoying thing about this is that every time I wanted to add PHP to a new section of a view I have to send them the path (as stated in the error, or in my server's logs) so they can add the path, but I guess it beats hackers running scripts on my server all willy-nilly

freeform.steph’s picture

I was also running into problems using the PHP input filter option with customview: Markup - this option seems to fail in loading the variables that should be available to the field.

The solution - used "customview: php code" option instead, I then had access to the variables, the lack of which were causing errors for me. If you need a list of these available variables, you can use this: print_r($data);

intyms’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

patrick.thurmond@gmail.com’s picture

Status: Closed (fixed) » Needs work

I think this should be re-opened. I am having the same problem, but mine actually worked at some point. At least up until this week. I used to be able to edit, add, and delete these fields no problem. But now it just stopped working. Spoke with our administrator and he said that nothing has changed with mod_security or anything else on that server in a long time.

So something else is definitely going on. The worst part about this is it seems to be intermittent. I can load/edit the field the first time almost every time. Saving (the individual field, not the view) is hit or miss as to whether it will give me a problem or not. But then every time I try to save the view it sends me to an access denied page: "You are not authorized to access this page. ".

Once I get either the PHP 403 forbidden error or the not authorized then I know that I am automatically logged off. I have to go log in again. So yeah fun.

patrick.thurmond@gmail.com’s picture

I will add that I don't have a problem editing pages on the site. Actually I just noticed that the problem happened when I went to save the view footer as well. So the problem is not isolated to the PHP field. Opening a new ticket.

intyms’s picture

Status: Needs work » Closed (fixed)

So the problem is not isolated to the PHP field

reverting back to Closed status

hiyikiyikas’s picture

May I know what exactly code is used? I have the same problem and is seeking out solution..

manoloka’s picture

Any ideas of what's happening? I got the same error, I've just emailed my hosting to check on the mod_security settings