Closed (fixed)
Project:
DraggableViews
Version:
7.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 May 2011 at 13:26 UTC
Updated:
31 May 2011 at 10:11 UTC
I would like to display a view page with a draggable table if the user has permissions to edit the view, otherwise display it with a custom theme template.
How would I do that?
Comments
Comment #1
ygerasimov commentedThere is permission 'Allow Reordering' that allows user to use draggable views. If this is not enough please describe the permissions model you would like to implement so we will think about how to reach it.
Comment #2
damd commentedYes, I can use that permission to only allow reordering for e.g. administrators. However, I would like to be able to use a custom template if the user does not have the permission to reorder the nodes in the view.
E.g., if I am the administrator I see the draggable interface as normal. But if I'm anonymous, I will not see the draggable table - instead I will see another UI which is rendered using e.g. views-view-fields--my-view-name.tpl.php.
Is this possible with DraggableViews today?
Comment #3
ygerasimov commentedYes you can do that. It is not functionality of draggableviews but more for theming. You can create function in your theme MYTHEME_preprocess_views_view_fields(&$vars). There you can check whether user doesn't have permission to use drag functionality add your custom template suggestion using $vars['template_files'][] = 'CUSTOM_TEMPLATE';
I you need to change any other template you can look at file theme/theme.inc of views module for names of preprocess functions.
Please advise whether it is what you need so I can close this issue.
Comment #4
damd commentedThank you, that will do!
Note however that my function needed to be declared as:
MYTHEME_preprocess_draggableviews_view_draggabletable(&$vars)
Comment #5
ygerasimov commentedGreat. Marking this issue as fixed.