I am using Views 3 and I was able to do some math on the fields using the "Views Custom Field" module that was recommended to me.

It works perfectly and does exactly what I want it to do, but my problem is that I need to grant access to users to create views and calculations on them. Views custom field is not really a math only field, it's basically allowing them to execute PHP code directly on my site, which I suspect is dangerous.

Also, another requirement is that they are not directly modifying the actual data, but creating a view for themselves(or to share) that derived from this data. That means the view they create must somehow be connected to their ID and not modify the master data.

I don't know if it is the best approach, but I was thinking of using something like phpexcel and exposing the tables so they can link to certain data; it seems complicated for me and even more complicated for the users.

How would you approach this?

1 Answer 1


You are right, you shouldn't allow people to change php code on your site.

I would allow a lot of customization to the data that is returned via views filters.

You can return the data in a table format and allow this table to be exported to excel or csv (there are views modules for both of these). Then people can create whatever they want.

There are a few js libraries which can give you spreadsheet like functionality in the browser with an HTML table, that may be an option too.

  • Thanks Jeremy. I've seen that there are different libraries but exposing my database to the site only seems like the tricky part. Not sure how thats possible to do(and less technical for the user). Maybe the final output to excel isn't a bad idea, but as much as possible I want to keep them on the site. Is there a way to only allow certain math operators? or a allow users to run a restricted version of php where they only have access to querying certain tables
    – Lostsoul
    May 25, 2011 at 14:39
  • No, giving php is all or nothing. If you want to keep them on the site, look at using a JS lib to make the site look like a spreadsheet. May 25, 2011 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.