By eljakeo on
I'm using Views 3 on Drupal 7. I would like to be able to create a custom access rule based on a value in a non-Drupal database. In other words, if the user attempts to access my view, I would like to first run a PHP script that checks for a specific value in a separate database, then returns a TRUE or FALSE whether to grant access. Views would then treat this the same way as it would if, for instance, a user didn't have the correct Role and a Role access rule had been set. I tried to find some kind of existing module that would let me add custom code this way, but I couldn't find any. Did I miss something? Or, how would I go about doing this in a custom module?
Thanks!
Comments
views_php
Hi,
Using views_php moudle u can customise a field.
You could use Contextual
You could use Contextual Filters but you'll most likely have to code a custom module to do this because accessing an external database required a lot of handling that would probably break Views.
## Note: The above code is fictitious. Any resemblance to real or actual working code is purely coincidental.
Thanks for your help. I ended
Thanks for your help. I ended up writing a module and it seems to work.