Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component specifications #36

Open
imath opened this issue Jun 5, 2022 · 11 comments
Open

Component specifications #36

imath opened this issue Jun 5, 2022 · 11 comments
Assignees
Labels

Comments

@imath
Copy link
Contributor

imath commented Jun 5, 2022

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 imath self-assigned this Jun 5, 2022
@imath imath added the resource label Jun 8, 2022
@imath imath pinned this issue Jul 8, 2022
@renatonascalves
Copy link
Member

The REST API to communicate with the server

Are you creating a custom controller specific to this plugin?

@imath
Copy link
Contributor Author

imath commented Jul 8, 2022

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.

@renatonascalves
Copy link
Member

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?

@imath
Copy link
Contributor Author

imath commented Jul 29, 2022

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.

@renatonascalves
Copy link
Member

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

@imath
Copy link
Contributor Author

imath commented Jul 29, 2022

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 😉 .

@renatonascalves
Copy link
Member

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.

@markcummins
Copy link

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?

@imath
Copy link
Contributor Author

imath commented Jan 5, 2023

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 👍

@markcummins
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants