Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
We have a setup where someone can buy a video, and on purchase completion (ACL + Content Access + Ubercart) they get an ACL view access. The video shows up only if they have this specific permission, but they can still access the node itself (with a video placeholder) without that permission.
I would like to create a view for purchased videos. One way to do that would be to pull all the nodes that have specific ACL view permission (as opposed to node access in general).
Is there a way to do this?
Any other ideas on how I can accomplish this?
Thanks,
Andrey.
Comments
Comment #1
mr.andrey CreditAttribution: mr.andrey commentedI ended up using a default argument with PHP code. It checks for all the ACL view permissions for the current user and returns the list of nodes.
Here's how to do it:
Under Arguments, create a new argument: "Node: Nid"
Under "Action to take if argument is not present", select "Provide default argument"
Set the "Default argument type" to "PHP Code", and enter the following:
Then check "Allow multiple terms per argument", and click "Update".
Best,
Andrey.
Comment #2
salvisThanks for sharing this. I wish we had a good place for keeping such snippets — the issues queue is not really the right place...
Comment #3
mr.andrey CreditAttribution: mr.andrey commentedI use Vim for note keeping. It has folds, so you can keep things very organized for yourself.
Cheers,
Andrey.
Comment #4
mr.andrey CreditAttribution: mr.andrey commentedAnd just for reference, if you're using Taxonomy Access module, and want to provide and argument for explicit node view permission based on a term and a role that has permission to view it, here's the mysql query for that:
Best,
Andrey.
Comment #5
salvisI mean here on d.o...
Comment #6
salvisNothing to commit, just mark this for keeps.
Comment #7
salvis