I have a view that displays a series of nodes in a blog format. Each node has a file attached to it. How do I make the nodes with files that the user has to login to see come last in the list?

I've been looking through the options available in Views and have come up short there. I was hoping I could create a relationship on the file, but I can't find any properties that relate to access control.

My other thought was that I could do this in a template, but I'm not sure if there is a template that will let me change the order of the rows in the view. Are those variables passed to the template by reference?

Many thanks.

  • Did you try drupal.org/project/draggableviews module?
    – heshanlk
    Jul 4, 2013 at 1:03
  • That is the right idea, but the files are going to be changing frequently and I don't want to put that responsibility on my client. How can I automate this?
    – doub1ejack
    Jul 9, 2013 at 15:31
  • 1
    The best way is implement hook_views_query_alter() and alter your query based on the logged in user role.
    – heshanlk
    Jul 9, 2013 at 20:06

1 Answer 1


In views under the Advanced section when you select the Theme: Information link, you can select to override a specific field.

Choose the most appropriate naming convention as this will dictate the scope of your override. Copy the text given by views and copy this into a new file in your theme called the .tpl.php file name you chose.

Once there you can add a conditional statement before outputting your field with user_access to check if your user has the right permissions to view the downloads.

You might have to specify the permission in your own module with hook_permission.

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.