Skip to:
Content

BuddyPress.org

Opened 7 years ago

Closed 7 years ago

#7657 closed enhancement (fixed)

Feature request : additional arguments in '_cover_image_uploaded' action

Reported by: pscolv's profile pscolv Owned by: djpaul's profile djpaul
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9.2
Component: Media Keywords: good-first-bug
Cc:

Description

Hi,

I'm trying to generate thumbnails of the cover image, and I found a dynamic hook that could have allowed me achieving that (in bp-core-attachments.php) :
do_action( $object_datacomponent? . '_cover_image_uploaded', (int) $bp_paramsitem_id? );

However, when in my callback function, I'm unable to do anything, since the only parameter in my possession is the item_id, and in particular I'm missing the cover image url.

Suggested change : add parameters to the action, which are available "for free" since they are already computed and about to be sent back to java : $name, $cover_url, $feedback_code

This way the '_cover_image_uploaded' hook allows much more possibilities as of today !

Regards,

Pascal.

Attachments (1)

7657.patch (642 bytes) - added by pscolv 7 years ago.
Patch for ticket #7657

Download all attachments as: .zip

Change History (14)

#1 @pscolv
7 years ago

  • Summary changed from Feature request : additional parameter in '_cover_image_uploaded' action to Feature request : additional arguments in '_cover_image_uploaded' action

#2 @DJPaul
7 years ago

  • Component changed from Core to Media
  • Keywords good-first-bug added
  • Milestone changed from Awaiting Review to 3.0

@pscolv Absolutely1 We'll get this done for 3.0. Do you want to try to create a patch for this improvement?

#3 @pscolv
7 years ago

Cool... thanks @DJPaul. I'm already experiencing that change on my side, so I could propose a patch yes, but I'm not familiar with the process there.

Let me know what I should do, will be glad to help.

Regards,

Pascal.

#4 @DJPaul
7 years ago

Are you familiar with either Git (or Github) or SVN?

#5 @pscolv
7 years ago

I'm familiar with both yes... I'm developing my website using Git at the moment...

#6 @DJPaul
7 years ago

OK, let's give it a go! https://make.wordpress.org/core/handbook/tutorials/working-with-patches/#creating-and-applying-patches-with%C2%A0the-command-line might a good place to start reading.

Basically, we need to:

1) Download a copy of BuddyPress from our Git or SVN repos.
2) Make the change in the code.
3) Test the change works.
4) Create a patch.
5) Upload that patch to this ticket.

It doesn't matter if you use SVN or Git to make the patch. Use whatever you're comfortable with. The Git repo URL is git://buddypress.git.wordpress.org/ (branch master) and SVN is https://buddypress.svn.wordpress.org/trunk. A Github clone is available at https://github.com/buddypress/BuddyPress

Once you've made the code change and tested it, you'll create the patch via svn diff or git diff. I hope the WordPress "Creating a Patch" documentation that I linked above explains the syntax for this, if you're unfamiliar with it.

Then, grab that new patch file (it's just a text file - take a look at it), and upload it to this ticket via "Attach file" button. After you've done that, be sure to come back to this comment area and say something like "I've attached a patch, please take look" -- that'll make sure we notice the new patch.

#7 @pscolv
7 years ago

Hi,

I started preparing the patch, unfortunately I'm seeing several regressions on my website when I'm using the trunk SVN version of buddypress, BEFORE I apply any change.

1) On the change-cover-image page, the area allowing to upload the cover image doesn't appear anymore.
I'm calling this part from my buddypress child theme, with the following code :
<?php bp_attachments_get_template_part( 'cover-images/index' ); ?>
=> Is this deprecated in BP3.0 ?

2) I'm repeatedly getting the following admin notice : "BuddyPress Xprofile Custom Fields Type plugin needs BuddyPress 2.5, please install or upgrade BuddyPress."

Do you consider those "regressions" as normal on your side, given the changes in BP 3.0 ?
How should I proceeed here ? I can still create the patch, but I will not be able to test it on this BP version. I tested it on 2.9.2 however.

Thanks,

Pascal.

#8 @DJPaul
7 years ago

Given 3.0 is not finished, I'd be inclined to call such things bugs, rather than regressions.

I don't have any ideas about your first point. For your second point, it looks like that plugin author needs to check the version number better. cc @donmik FYI.

#9 @DJPaul
7 years ago

Don't worry about testing it on your live website. That's extremely good of you to try, and perhaps you found a bug while doing it. Thank you!

I had assumed from your writing you had a local development website, or a copy of your website where you could try, but given you've already tested on 2.9.x, that's fine.

#10 @pscolv
7 years ago

Hi Paul,

I (finally) created the patch and attached it to this ticket. Let me know if everything's OK.

Regards,

Pascal.

P.S. I tried again to test my website against the latest buddypress version from the SVN repo, and I still get a blank area where I should see the cover image upload form.

@pscolv
7 years ago

Patch for ticket #7657

#11 @DJPaul
7 years ago

I'll take a look at this next week! Thanks again!

#12 @DJPaul
7 years ago

Good patch @pscolv!

#13 @djpaul
7 years ago

  • Owner set to djpaul
  • Resolution set to fixed
  • Status changed from new to closed

In 11879:

Core, Media: add parameters to dynamic _cover_image_uploaded action.

Adds the parameters returned in the AJAX response, to make this dynamic action more useful for PHP developers.

Fixes #7657

Props pscolv

Note: See TracTickets for help on using tickets.