bp-attachments icon indicating copy to clipboard operation
bp-attachments copied to clipboard

Component specifications

Open imath opened this issue 3 years ago • 11 comments
trafficstars

BP Attachments is a BuddyPress Add-on to manage community members public and private media.

Development choices

  • The REST API to communicate with the server
  • WordPress bundled's ReactJS & Block Editor's components to build the Admin/Front UIs
  • No MySQL Table, simply uses the filesystem, just like Avatars or Cover images.
  • Use BP Rewrites way of generating BP Navs permalinks

Type of objects

  • private and public files,
  • private and public folders (actually the folder is a file having the inode/directory mime type).

Folders can have different types:

  • Regular files directory,
  • Photos album,
  • Audio Playlist,
  • Video Playlist.

The last 3 types cannot have sub-folders and are not available for private uploads.

Filesystem organization

Public files and folders

  • Base directory: /wp-content/uploads/buddypress/public
  • Members directory: /wp-content/uploads/buddypress/public/members/{$user_id}
  • Public Groups directory: /wp-content/uploads/buddypress/public/groups/{$group_id}

Private files and folders

To have private uploads available, the Site Administrator needs to create the buddypress-private dir one level upper the site's document root and make sure this folder is accessible read/write/delete to the Machine Server's user.

  • Base directory: ../buddypress-private
  • Members directory: ../buddypress-private/members/{$user_id}
  • Non public Groups directory: ../buddypress-private/groups/{$group_id}
  • Friends directory ../buddypress-private/friends/{$user_id}

User capabilities

If each regular user can upload media to their own directory, there's probably a need to allow Group Admins to moderate files and folders generated to the group.

Site Settings

Administrators will be able to select the allowed mime types from the BP Options settings page tab. Here's 2 preview of these settings panel:

attachments-settings-ui

Clicking on one of the accordion element will show the checkboxes to enable/disable mime types for the corresponding media category. Below is a screenshot of the Image panel.

attachments-settings-ui-media-unfold

--- To be continued ---

imath avatar Jun 05 '22 07:06 imath

The REST API to communicate with the server

Are you creating a custom controller specific to this plugin?

renatonascalves avatar Jul 08 '22 15:07 renatonascalves

Yes it's more convenient, and if you remember well, a while ago it inspired you when you improved the BP Rest API Attachments endpoint.

imath avatar Jul 08 '22 19:07 imath

Something that just came to mind: should the plugin be built to allow other file storage options? Will it be easy for advanced or custom scenarios/use cases where the WordPress uploads folder structure is not used?

renatonascalves avatar Jul 27 '22 11:07 renatonascalves

I think hooks are already in place to make this possible. For instance private media are not stored into uploads, a guide is explaining the admin how to put the directory in place out of site's root directory.

imath avatar Jul 29 '22 09:07 imath

So there are hooks in place to account, or bypass the default behavior, for CRUD actions like adding and deleting images?

renatonascalves avatar Jul 29 '22 13:07 renatonascalves

The second part is different compared to your initial question 😄 . Only the destination upload paths are customizable for now. Let's progress about this v1 and we'll see, when features are solid, to fine tune hooks before releasing it 😉 .

imath avatar Jul 29 '22 19:07 imath

Ah, cool!

When I said other file storage options, I meant something like Laravel File Storage, https://laravel.com/docs/9.x/filesystem, where you can hook drivers and your assets can go to S3, for example.

So maybe allowing plugins to extend this feature to put images in places other than the WordPress filesystem.

renatonascalves avatar Jul 29 '22 19:07 renatonascalves

Awesome work on this. I see in one of the files it says 'Groups support should happen in a future version', do you have a rough idea on when the groups part might be ready?

markcummins avatar Jan 04 '23 16:01 markcummins

Hi @markcummins

Thanks for your feedback 😍. It's actually possible to share media into Groups using Activities. These media are owned by the group members who shared the activity. The difficult part about Group Attachments is about "ownership". So we need a bit more time to find the best way to deal with it. Once a stable 1.0.0 release will be published (I hope before the end of the month), we'll be able to have more feedbacks/ideas so it should help us build the feature in the next major version 👍

imath avatar Jan 05 '23 05:01 imath

Perfect, thanks for the update, thats very helpful. We are currently using the RT Media files plugin for Profile and Groups, but it doesn't have the ability to create folders, and it's a bit difficult to navigate. We got some feedback saying that being able to organise their files would be a big help to them.

@renatonascalves maybe something like the Offload Media plugin could help with offloading the files to somewhere other than WordPress.

markcummins avatar Jan 10 '23 10:01 markcummins

Thanks for your feedback heart_eyes. It's actually possible to share media into Groups using Activities. These media are owned by the group members who shared the activity. The difficult part about Group Attachments is about "ownership". So we need a bit more time to find the best way to deal with it. Once a stable 1.0.0 release will be published (I hope before the end of the month), we'll be able to have more feedbacks/ideas so it should help us build the feature in the next major version +1

@imath, thanks again for answering my question. We have some members who are interested in using Groups on our site in a few months, and they are asking for a way to upload and organise Group files. Do you think the next major version of this plugin might be ready around March or April, or do you think it will probably be much later?

I know that's probably a very difficult question to answer right now, so no problem if you aren't able to give a more accurate answer.

markcummins avatar Jan 13 '23 12:01 markcummins