I was wondering if it would be possible to have a Media library per OG. It would be very nice if a user that is part of group A, only see the media items that are used/uploaded in group A, and not those that are used in other groups.

Would such requirement be possible? How could I tackle this?

Comments

miromarchi’s picture

I'm interested in a media browser per organic group too.
Should we modify the media browser view, adding a relationship to "og membership from node", then a contextual filter to "(og membership from node) og group ID", and then a filter criteria "(og membership from node) og membership: group type=node"?

devin carlson’s picture

Status: Active » Fixed

I'm not sure what the best way to have a media browser per group would be, but you could alter the media element (hook_element_info_alter()) in order to output the group's ID to JavaScript and then implement hook_query_media_browser_alter() in order to alter the media browser depending on the group ID.

If you want to restrict certain files to certain groups, you might want to implement hook_schema_alter() in order to add a group ID column to the {managed_file} table or use the Flag module to add a flag to files which represents which group they belong to.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.