Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

#5999 closed defect (bug) (fixed)

Notice when uploading a group avatar with WP Trunk (4.1)

Reported by: imath Owned by: imath
Milestone: 2.2 Priority: normal
Severity: normal Version:
Component: Groups Keywords: has-patch commit
Cc:

Description

Using WordPress latest trunk (4.1), I have a _doing_it_wrong each time i upload a group avatar. No BuddyPress functions seems to be in the process. So i wonder if it's a BuddyPress or a WordPress bug. Here's a screen cap of my xdebug notice :

https://cldup.com/OgnT12M2Pn-2000x2000.png

Attachments (2)

5999.patch (1.9 KB) - added by imath 5 years ago.
5999.02.patch (1.7 KB) - added by imath 5 years ago.

Download all attachments as: .zip

Change History (9)

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


5 years ago

#2 @imath
5 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 2.2

Actually the problem is happening each time an avatar is being cropped. In this step, a form is sending a $_POST['w'] variable that WP_Query is interpreting as a 'week' parameter. After chatting with boonebgorges, as the form is built inside the templates :

  • groups/create.php
  • groups/single/admin.php
  • members/single/profile/change-avatar.php

It seems the best solution is to reset the week query var. See 5999.patch

@imath
5 years ago

#3 @boonebgorges
5 years ago

Nice find!

'parse_query' logic looks good. IMO, we don't need a function bp_core_avatar_is_crop_step() - I'd suggest moving the logic into the bp_core_avatar_reset_query() function.

#4 @DJPaul
5 years ago

I'm not sure why you need to cast the value of bp_is_group_admin_screen and group-avatar' == bp_action_variable( 1 ) to bools; they both return bools anyway. I think you can also use === here safely.

#5 @imath
5 years ago

Thanks boonebgorges and DJPaul for your feedbacks. 5999.02.patch is taking them in account.

@imath
5 years ago

#6 @DJPaul
5 years ago

  • Keywords commit added

Looks good

#7 @imath
5 years ago

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

In 9158:

When cropping an avatar, make sure the "w" crop parameter does not interfere with WP_Query

In the different edit-avatar templates, cropping forms include a field named "w". When posted, this particular posted variable is interpreted as the week parameter of the main WordPress query. This commit introduces a new function bp_core_avatar_reset_query() that will make sure the week parameter is not set when an avatar is being cropped.

props boonebgorges, DJPaul

Fixes #5999

Note: See TracTickets for help on using tickets.