BuddyDrive 1.3 Utilizes the New BP Attachments API

photo credit: Paperclips - (license)
photo credit: Paperclips(license)

One of the most exciting features added in BuddyPress 2.3 is the new BP Attachments API. It provides a BP core-supported method of managing user-submitted files and opens up a world of possibilities for plugin developers.

The API powers the new avatar uploads UI, but it can also be used to extend BuddyPress to add media sharing capabilities. If you want to see a good example of this in the wild, check out BuddyDrive version 1.3.0. The plugin was created by BP core developer Mathieu Viet, who led the effort to get the BP Attachments API into the latest release.

BuddyDrive allows members to share a file or a list of files with the community and includes various settings for restricting access. It’s essentially like a Dropbox clone for BuddyPress, designed to enhance collaboration between members. The plugin was a prime candidate for adapting the BP Attachments API to power community file sharing in a simpler, more elegant way.

You can see it active in the new “BuddyDrive Editor” included in version 1.3, demonstrated in the video below:

Viet posted an example function in the plugin’s wiki to show how the BuddyDrive Editor can be placed anywhere. The feature is a good example of how easy it is for developers to leverage the API to manage user-generated media from the frontend.

BuddyDrive 1.3 is currently in beta and on track to be released soon. If you’d like to help test the beta or inspect the code to see how it works, you can download a zip file from Viet’s preview post. The unreleased version 1.3 is also available on GitHub.

If you want to learn more about using the new BP Attachments API, check out Viet’s comprehensive BP codex article. It walks you through extending the BP_Attachment class to validate and store files in a subdirectory of wp-content/uploads. The documentation also includes a sample plugin to demonstrate how you might add attachments to private messages.

Would you like to write for WP Tavern? We are always accepting guest posts from the community and are looking for new contributors. Get in touch with us and let's discuss your ideas.

2 Comments


    1. Hi Sol,

      Thanks a lot for your comment, I’ll try to!

      And of course, many many many thanks to Sarah for her great post.

      I’m currently working on the WordPress repo of the plugin, so you should be able to update to 1.3.0 in a few hours :)

      Report

Comments are closed.