Hello,
I have a situation in which I want to create content that can only be accessed by a particular user role. I will be using UberCart to setup a subscription product that will in turn assign a special "subscriber" user role for a determined length of time so that the premium content can be accessed by the subscriber.
I have created a new content type that I use for video lessons and I have the nodeaccess module installed and configured so that only administrators and the special "subscriber" roles can view the content which works fine. The problem that I am having is that I would still like to have a view that lists the titles and descriptions of the various video lessons no matter what role a user belongs to but when when clicked on to view the full node, the user would be unauthorized to access the page and see the video unless they belonged to one of the acceptable roles.
I created a Page view that returns the node title and node body of the video lesson content type and then I themed it in my template.php to only display the Title and Description and not the video itself which is an attachment to the node. Unfortunately, since a view returns a list of nodes, it will not return anything if the user is not of the "subscriber" role, it will just display a blank screen. It obviously works fine if I am logged in as one of the accepted roles where I can now see a list of the titles and descriptions.
I suppose that I could do something such as remove the "subscriber" role restriction assigned to the content type by the nodeaccess module and then create my own node-video_lessons.tpl.php file that would manually check the current user's role before displaying the content. This way, the view that I created should now return a list of video content nodes with the video removed from the display output by the theming that I did.
In any case, if this is making sense, can anyone tell me if there is an another, better way of doing this. I don't want to have to hard-code user role checks in template files if not necessary in case roles change or other unforseen things happen.
Thanks