Skip to:
Content
Pages
Categories
Search
Top
Bottom

Create Cover Photos using the new BP_Attachment API

  • @brianbws

    Participant

    How would I go about adding a new menu item next to “Change Profile Photo” called “Change Cover Photo” that would allow users to create to set a cover photo using the new BP_Attachment API? Ideally users could also crop the photo to a certain ratio like they do avatars.

Viewing 5 replies - 1 through 5 (of 5 total)
  • @henrywright

    Moderator

    Hi @brianbws,

    You’ll need to extend the BP_Attachment class with your own subclass. See the BP_Attachment article for more info.

    @brianbws

    Participant

    So I’ve taken a stab at it and gotten the tab to show in the correct place, but my Cover_Photo_Attachment attachment class still is not uploading images and I’m not sure why. Trying to follow the great work of @imath and the BP_Attachment documentation.

    Also having trouble trying to get the Avatar UI to show for a nice upload experience. Is it even possible to repurpose that UI for this? Any help would be appreciative.

    See my code:

    https://gist.github.com/brianrc/912c95d28e913b3aad23

    @imath

    Moderator

    hi @brianbws

    Here are some advices :
    1/ I wouldn’t “mix” a cover photo into the avatar UI, it’s not the same need
    2/ I would create a new profile tab “Change cover photo”
    3/ From there, i’ll use a regular upload/crop experience or build a new UI using Backbone like i’m doing in the next version of this plugin https://github.com/imath/buddydrive/tree/1.3 > follow the buddydrive_editor() function to see how to do this.
    4/ I’ll extend the BP Attachment class > the codex page should help you.

    To extend the avatar UI, you can have a look at the plugin BP Avatar Suggestions 1.3, i’ve updated it to add a new tab to the UI because : it is to set an avatar 🙂
    This plugin also creates an upload UI and extends the BP Attachment class.

    I think watching the codex page, the 2 plugins, will help you. Bye.

    @brianbws

    Participant

    Thank you. I’ve tried examining the BuddyDrive implementation, but I am just lost and I don’t understand backbone at all.

    I’ve also been patiently waiting and watching for any other use of the BP_Attachment API on Github, but unfortunately have found none.

    It’s such a cool feature, but I fear too complex for me. Hope others take up the cause soon.

    @henrywright

    Moderator

    Most likely there are things in the pipeline but we haven’t seen them come into fruition yet. The new API was introduced at the beginning of June so hopefully we should start to see plugins appear over the next few months.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Create Cover Photos using the new BP_Attachment API’ is closed to new replies.
Skip to toolbar