0

I would like some pointers as to what might be the best approach to this issue please?

An admin role needs to be able to interact with a list of nodes for a fitness site. They need to be able to show/hide these nodes in a list for 'lesser' roles. In addition to this the admin needs to be able to mark the node as complete so that the 'lesser' role can see this update. ie

Admin sees options to amend node list:

Lose 10 lbs - Show - Mark as complete

Attend 2 sessions - Hide - Not marked as complete

Run 3 miles this week - Show - Not marked as complete

'Lesser' role sees:

Lose 10 lbs - Complete.

Run 3 miles this week - Incomplete.

Obviously, I would like to be able to extend this list so that each user is able to see a list that is unique to them, which the admin role has interacted with to show/hide and complete/incomplete different sections.

I'm puzzled as to what approach I ought to take and would really welcome some suggestions to get me started.

Thanks.

1 Answer 1

0

From the interface that you have outlined, I could see that the 'Flag' module might be really nice for the administrator and user to interact with this kind of list. In a list of nodes, flags would allow in place editing, changing the status, without going into each individual node.

You could configure the names of flags, status, and transition. It would also be possible to assign permissions as to who has permission to change flags between states, and to allow users to change some of the flags themselves.

http://drupal.org/project/flag

To restrict what is seen by the users in the lists, perhaps you could build two similar views blocks: one showing all of the nodes (for administrator), and the other filtered only to show those with flag set to 'show' (for normal users).

The options in each view can be configured to selectively shown each block only to the appropriate role, and then both blocks could be embedded at the appropriate place.

Please note, that is not really enforcing permission to view the hidden nodes, and that a user could find them if they really try hard. It's just being selective about what is shown in the lists.

I was not able to quickly spot an existing module in drupal.org which would set node access by flag status. You may have some luck with some further searching.

However you can use 'Rules' to take actions on flag changes. I think you might be able to pull something together by setting up a series of rules which then assign individual node permissions using 'content access' or another node access module of your choice when the show/hide flag changes state.

Otherwise you could use node_api and write your module to enforce your particular access rules based on flag status.

3
  • Thanks for taking the time to reply. I'm really unfamiliar with the flags module - and Drupal as a whole if the truth be told, but I have a further question if that is okay? I want to be able to 're-use' the nodes that each user is going to be looking at. What I mean is that I intend to set up 20 nodes with different exercises that a customer might perform. The site admin would then flag the hide/show AND complete/incomplete against these nodes for EVERY user of the site. Do you think that this is possible? Might using a taxonomy be good for setting up the exercises? Thanks again.
    – njwrigley
    Sep 28, 2012 at 19:42
  • It would be possible to use a taxonomy to manage a set of predefined tasks, and then to attach them to a particular person's plan by having a field which is a selection list. Oct 1, 2012 at 13:59
  • However this becomes difficult when you want to attach more complex information to each target. Although there is some support for field grouping which might do this, I think it would seem likely that the number of associated bits of information with each users' target might grow, as the application develops - eg completed status, start date, trainer, etc. I think it would be simpler to take each person's targets as being separate nodes, and allow you to expand later. You may find it useful to take a look at "automatic node title" and "node clone" to make it easier to create new targets. Oct 1, 2012 at 14:12

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.