A good way to shape the future of BuddyPress Attachments is to take care of Avatars

As you never miss the great dev-chat summaries @mercime is posting with love, you already know the core team has been working on a new BuddyPress Attachments API for the 2.3 release.

You should know 2.3 will bring a new class, BP_Attachment, developers will be able to extend to manage user uploads. In core we are using it to take care of avatar uploads. We will soon write a codex page about it, but if you’re eager to play with it, you can already observe what we’re doing in the BP_Attachment_Avatar class (see #6278).

You should also know, we’ve been working on a richer user interface to upload / crop / set a profile photo for a user or a group. It landed in trunk yesterday, we’re very excited to have it in our next release and we hope you are too 🙂 (see #6290)

The Upload view of the Avatar UI

The Upload view of the Avatar UI

Members will be able to use their computer’s webcam to set their profile photo if they are using a browser supporting getUserMedia.

Camera view of the Avatar UI

Camera view of the Avatar UI

It will be possible to edit a member’s avatar from his extended profile in WordPress administration.

Crop view in wp-admin/extended profile

Crop view in wp-admin/extended profile

A few notes:

  • It’s not removing the legacy screens, it’s actually using them as a fallback if javascript is disabled.
  • Although we’re convinced it’s a great improvement, some of you might feel better with the legacy interface. If so you will be able to disable the new UI by using this filter add_filter( 'bp_avatar_is_front_edit', '__return_false' ) in your bp-custom.php file for instance.
  • For the first introduction of this feature, we wish to “keep some control” over the Backbone templates. These templates will be organized in an “_attachments” folder. The underscore prefix means : “we advise you to avoid overriding this folder’s templates from your theme”.
  • About theme compatibility: the “avatar” templates of the template pack we ship with the plugin (bp-legacy) will use a new template tag to display the interface. If you are overriding these templates from your theme and if by the time 2.3 will be released you forgot to update them, we will try to load the interface using one of these template hooks :
template hook template file
do_action( 'bp_after_profile_avatar_upload_content' ); buddypress/members/single/profile/change-avatar.php
do_action( 'bp_after_group_admin_content' ); buddypress/groups/single/admin.php
do_action( 'bp_after_group_avatar_creation_step' ); buddypress/groups/create.php

#6278, #6290