Views Filter for Premium Content
alexkb - February 24, 2007 - 06:34
| Project: | Premium |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
Has anyone ever created a views filter for nodes that are Premium/not Premium ?
I tried taking another sub module i.e. module/views/module/views_users.inc, and creating a version for premium, but it seems a but beyond me.
If not, can anyone point me in the right direction for writing one. There's a bit of documentation on View Filters but nothing in respect to code.
Thanks.

#1
This would be so valuable.
I have searched everywhere for a sub module to integrate Premium and Views.
I can't believe that Premium module users haven't created this feature already!
#2
The policy of Views is that only core modules are supported natively. Views doesn't support additional modules; modules must implement the Views API or another project can do it. There are simply too many contrib modules.
Sending this feature request to Premium module.
#3
I was just about to post another "I want this too, but I'm stuck" question, when I had a stroke of genius and managed to figure this out! By hacking together bits from the views_node.inc and some views code from img_assist.module, I have created a views_premium.inc file that works. It provides a filter for whether or not a node is Premium content. So, if you select Yes, only Premium content nodes will be shown. If you select No, only nodes that are NOT Premium content will be shown i.e. premium content nodes are not shown. Maybe this is obvious, but I'm sure someone might ask that question at some point.
The include file is attached (delete the .txt extension). It must be placed in the views/modules folder. I will also create a patch for premium.module to make it simpler in future versions of the module so that the include file is not necessary. In the meantime, use the include file.
#4
And here's the patch for premium.module. Works well on my system. Note, after patching, I had to disable premium.module, then re-enable it to get the Filter to appear.
PS. The extra code came from image_attach.module (included with image.module) and not img_assist, as I said above.
#5
Just an update on this all important patch (at least for those of us in this issue) - it still works in the 1.0 version of Premium. I must say I'm a little surprised it didn't get added into the module already, but hey, I'm not the maintainer, so its not my call :) Anyway its here for others.
@maintainer, if you want me to reroll against the latest premium, let me know.
#6
Hey guys, have updated a release for Drupal 6, here:
http://drupal.org/project/premium_views_filter
Cheers.