New component to manage BuddyPress "attachments"
|Reported by:||imath||Owned by:||imath|
|Component:||Component - Attachments||Keywords:||2nd-opinion|
|Cc:||jess@…, mercijavier@…, needle@…, vivek@…, hugoashmore@…|
We've been talking about managing media in core in previous dev-chats. I thought about it, explored, and began building something a bit messy at the moment but working ;)
Though, i think it's too early to "attach" (!) a first patch. First, i'd like to have your opinion on the way i see things in this area.
My main idea is to have a component that would help others to deal with files. So far, BuddyPress is already dealing with image files for groups & users avatar management.
So i thought, let's start from here and with this kind of files : images.
Avatar "management" in WordPress Administration screens
I've been working in this area for wp-admin/profile feature and the signups management screen #5374 (again a huge thanks to boonebgorges for reviewing and improving it). And i thought, in this profile and the group administration screen, it could be interesting to give a way to the community administrator to deal with these avatars without going back to the front office of his website.
To do so i'm using a customized WP Media Editor without changing anything to the core avatars API.
Avatar metabox, full version of the screen cap
Avatar "editor", full version of the screen cap
A unique function to add an attachment
I like the way wp_editor adds a wysiwyg editor and i thought, i could be interesting to have such a way to launch our "attachments" management feature. So i built a class to enqueue script, css and to add the needed settings and strings to the media editor. Thanks to it we could be able to add an avatar to a group or a member in front or backend of the blog and we could extend it to manage other attachments for the members, the message component and why not any other component created by a plugin.
A Custom Post Type to organize components attachments
So i kept on exploring and came to the conclusion that the best way to handle attachments was to benefit from the WordPress attachment API by creating a "container" object to hold a bunch of files. The huge advantage of doing so is that a lot is already done by WordPress. We just need to add some hooks at key points, map some capacities and a custom BackBone script to extend the media editor views (library, uploader, select..). So i built an example of extending the members component to provide a "Photoset" feature to the community users. From their profile page, they can create a photoset (or album) and then add photos to it. Here are some screen captures of the different part of this example.
the photo uploader, full version of the screen cap
the tab to manage the photos, full version of the screen cap
the user's attachment page, full version of the screen cap
Before going on, i'd like to have your feedbacks / opinions about this idea :
- What do you think of it globally ?
- I think it would be interesting to find a very generic term for the attachments container so that it could be used for other type of files than images in the future if we need to (it can be used for organizing the attached files to a private message...). If so what would it be named like ?
- Has_directory : i may be wrong on the subject, but as notifications or messages, i believe attachments shouldn't have a directory page
- What would be the "community actions" : share in activities ? favorite, like, download counter ...?
- I think we must try to build a kind of "BuddyPress Attachments API" to help plugins to rely on it for the custom components they're creating.
This is it for now, i'm curious about your feedbacks. You can watch a demo of the different parts i've talked about from my vimeo account :
Change History (27)
- Component changed from Component - Any/All to Component - Attachments