I have a selection of groups (Organisations).
In each group are a number of "centres".
Each centre will have some "course" content associated with it. To do this I have a node reference to the centre content from the course content. When a member of a group adds a course, I want only the list of centres that are in their groups to appear.
I am trying to make a view to achieve this. but am struggling to link the logged in user (argument ?) to the posts (centres) in a node. I also want if the site admin is logged in, he will see all "centres".
Any help would be appreciated. I'll sleep on it anyway.
Comments
Comment #1
exobuzz commentedI;ve got this working, but I wonder if this is the right way to to things ?
First of all I wonder if a node reference is the best way of linking this data. Should I be using some hierarchy module ?
to get this to work I made a "node view" with
Relatioship:
Organic groups: Group node (post) (required)
Filter:
Node: Type = Centre
Argument:
(Group node (post)) Organic groups: Member of a group
with a default value of logged in user, but wiht php validation with some code
and if it doesn't validate then "show all values".
I then use this view for the node reference. Does seem a bit of a hacky way to do it though. Would be nice if with user stuff it could be "or is a member of some role" type logic.
Comment #2
exobuzz commentedI have another problem now in that if someone is a member of more than one group, they could technically post a course to "group A" for a centre that is in "group b". If i could have it so that when they select the group when "adding content", it refreshed the page, so that I can then display only the centres for the currently selected group.
If anyone could help me with this it would be most appreciated.
Comment #3
seancorrales commentedThanks for detailing the view you created in post #1 - that was just what I was looking for!
I'll give some thought to your question in #2 and see if I can help. Thanks again, exobuzz!
Comment #4
claudiu.cristeaThis version of Drupal is not supported anymore. If this is still an issue in the
8.x-1.xbranch, please open a new up-to-date ticket. Closing.