[buddypress-trac] [BuddyPress Trac] #5429: New component to manage BuddyPress "attachments"
buddypress-trac
noreply at wordpress.org
Tue Feb 25 22:48:56 UTC 2014
#5429: New component to manage BuddyPress "attachments"
----------------------------+-------------------------
Reporter: imath | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 2.0
Component: All Components | Version:
Severity: normal | Keywords: 2nd-opinion
----------------------------+-------------------------
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.
[[Image(http://farm6.staticflickr.com/5515/12779903993_2aebf0e864.jpg)]]
Avatar metabox,
[http://www.flickr.com/photos/im4th/12779903993/sizes/o/in/photostream/
full version of the screen cap]
[[Image(http://farm6.staticflickr.com/5493/12779774695_e4f33ffd88.jpg)]]
Avatar "editor",
[http://www.flickr.com/photos/im4th/12779774695/sizes/o/in/photostream/
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.
[[Image(http://farm6.staticflickr.com/5531/12780215164_1fdabb7984.jpg)]]
the photo uploader,
[http://www.flickr.com/photos/im4th/12780215164/sizes/o/in/photostream/
full version of the screen cap]
[[Image(http://farm4.staticflickr.com/3718/12779774595_0ce815b6c4.jpg)]]
the tab to manage the photos,
[http://www.flickr.com/photos/im4th/12779774595/sizes/o/in/photostream/
full version of the screen cap]
[[Image(http://farm8.staticflickr.com/7318/12779903853_de55b9775a.jpg)]]
the user's attachment page,
[http://www.flickr.com/photos/im4th/12779903853/sizes/o/in/photostream/
full version of the screen cap]
[[Image(http://farm8.staticflickr.com/7345/12780215424_7058c05e83.jpg)]]
the directory structure
Before going on, i'd like to have your feedbacks / opinions about this
idea :
1. What do you think of it globally ?
2. 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
?
3. Has_directory : i may be wrong on the subject, but as notifications or
messages, i believe attachments shouldn't have a directory page
4. What would be the "community actions" : share in activities ? favorite,
like, download counter ...?
5. 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 :
[http://vimeo.com/imath/attachments]
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5429>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list