Unable to upload new media in media library within a group

Created on 17 November 2022, over 1 year ago
Updated 10 May 2023, about 1 year ago

Problem/Motivation

I want to upload new media directly from the media library, and have it assigned to the correct group, either attached to a paragraph or from within CKEditor via media embed.

This does not seem to be working.

I can upload new media, but it is not displayed in the media library after upload to be selected and inserted.

What does work is visiting the /group/1/media page and creating new media directly. This is then available to insert from the media library, either in a paragraph or in CKEditor media embed.

Anyone else able to replicate this?

πŸ› Bug report
Status

Closed: works as designed

Version

4.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom Finn Lewis

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States maskedjellybean Portland, OR

    I don't think that Group Media provides any integration with Media Library so I don't think this is a bug. Of course it would be way more useful if it did, so I took a shot at modifying Media Library and documented my code here: https://www.drupal.org/docs/contributed-modules/group-media/using-group-... β†’

    As far as I can tell it's working so far. If anyone else could give it a try that would be awesome.

    I could see many different possible approaches to this but what made the most sense to me is to limit the media displayed to only media that belongs to the current group (the group that the node being created/edited belongs to).

    I could see another approach where the media is limited to only media that belongs to any groups that the current user belongs to ( that is the approach taken here β†’ , except with the Media Entity Browser contrib module, not the core Media Library module). The problem with this is that the user then has the ability to add media from a different group to a node in the current group. As soon as that happens, the group which the media belongs to becomes essentially meaningless because the media is used in content that belongs to two different groups.

  • πŸ‡§πŸ‡ͺBelgium LOBsTerr

    I am trying to figure out, what exactly you want to achieve, but it is very hard to understand from the description and you latest comments.
    We always need to know to which group we add media. For this we are using Media Finder plugins or just direct group's module interface, but when we add media through library we don't have this information.
    Maybe if you can provide more information or rephrase it. It would help a lot.
    Thanks

  • πŸ‡³πŸ‡ΏNew Zealand RoSk0 Wellington

    It looks like the point of this issue is about providing integration , or support rather, between this module and media library.

    I see how that could be problematic based on the above comments and code review of https://www.drupal.org/docs/contributed-modules/group-media/using-group-... β†’ .

    However implementing media library support would be a hude UX improvement imho.

  • πŸ‡§πŸ‡ͺBelgium LOBsTerr

    I have used Media Library in any of our projects and I don't have much experience with that.
    That is why I am asking these questions. I need to know exactly, what users expect. So, it would be easier for me to find the solution.
    Let's first define the scope of the problems and then we will do it step by step

  • Status changed to Closed: works as designed over 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand RoSk0 Wellington

    I haven't tested with paragraphs , but I've used a custom bundle node and referenced three media items from it:

    1. Image via entity reference field - uploaded via media library modal
    2. inserted existing media image in the body via Insert from media library CKEditor 4 button
    3. inserted new media document in the body via Insert from media library CKEditor 4 button - uploaded via media library modal

    All three case were successfully detected and added to the group and become visible on the group Media tab.

    I suspect that issue author had tracking_enabled configuration option turned off, or the Media types to exclude in play.

    P.S. Big thanks for this module and particular feature to the authors and maintainers!

  • πŸ‡ΊπŸ‡ΈUnited States maskedjellybean Portland, OR

    Thanks for the discussion. The code in my example to limit media displayed in the media library could be improved in many ways (knowing which media plugins are installed would help a ton). Doing this entirely by $query->addWhere() would be much faster if it were possible. Feel free to improve it if you feel inspired.

    I'll try to describe the problem differently:

    The media library displays all media from all groups. This allows users to add media from any group to the current group, which may not be desirable (or even possible based on cardinality settings). If the media library only displayed media from the current group we could avoid this issue.

    I was confused about what you meant by tracking_enabled since groupmedia has no configuration accessible from the UI, but I see this in groupmedia.setting.yml and it is set to true.

    Additionally, the media library upload field should add the media to the current group. I took a shot at that and now realize today that there's a submodule that appears to do that already...

    While I was looking for this I discovered the Group Media Paragraphs tracker submodule. Amazing! Could we document that this exists? It appears to do what my custom form submit was doing (adding the newly created media to the group).

    So now I have to ask, what is the difference between the two? Does tracking_enabled add media to the same group as a node when the media is uploaded to a media field directly on the node? And Group Media Paragraphs tracker does the same thing except when a media field is on a paragraph?

  • πŸ‡ΊπŸ‡ΈUnited States maskedjellybean Portland, OR

    Ok, I realized there is much more documentation in README.md and this answers all my questions and about adding media to the group. I'm going to delete my hook_form_alter from the drupal.org documentation because the Group Media Paragraphs tracker submodule makes it redundant.

    There is still the question of filtering media in the media library to only media in the current group.

  • For me I have the problem in item 2 of the scenarios below and I haven't been able to solve it in any way yet, can anyone try to help with this?

    1- Create media by a body CKEDITOR field directly in the node by modal Media Library:
    Result: OK
    - Insert the average normally
    - Media appears in the group's media overview
    - Media Is linked to the group

    2- Create media by a CKEDITOR body field inside a Paragraph by modal Media Library
    Result: Not OK!
    - Insert the average normally
    - Media does NOT appear in the group's media overview
    - Media is NOT linked to the group

    3- Create media by a MEDIA field inside a Paragraph by the Media Library
    Result: OK!
    - Insert the average normally
    - Media appears in the group's media overview
    - Media Is linked to the group

    I'll upload a video later exemplifying in practice.

    Settings:

    Enabled: Enable media tracking
    Enabled: Group Media Paragraphs tracker

    Drupal: 9.5.7
    Group: 8.x-1.5
    Groupmedia: 8.x-2.0-rc2
    PHP: 7.4.30
    MYSQL: 8

  • I identified that the problem happens in the RC1 version, I believe it is related to 3337161 πŸ“Œ Use MediaFinder to add media in paragraphs to groups Fixed .

    The big problem with this is that I tried to go back to the Alpha11 version that works correctly and apparently something in the downgrade doesn't go well and it doesn't work correctly again, just after uninstalling groupmedia and installing again.

  • πŸ‡§πŸ‡ͺBelgium msnassar

    Hello @maskedjellybean

    We have the same requirements for a website. As we now need to do the same for a new website, I have created a contrib module ( Group Media Library Extra β†’ ) for handling the issue in a pluggable way. Feedback would be welcome!

Production build 0.69.0 2024