Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5755 closed defect (bug) (fixed)

xprofile_updated_profile action not properly passed old values

Reported by: Viper007Bond Owned by: djpaul
Milestone: 2.1 Priority: normal
Severity: normal Version: 2.0
Component: Extended Profile Keywords:
Cc:

Description

The function xprofile_screen_edit_profile() updates profile fields and has $new_values and $old_values variables which are passed to the xprofile_updated_profile action. This action is useful for monitoring when profile fields are updated.

The problem is that $old_values is called after the value is updated via xprofile_set_field_data(). This means that $old_values will always contain the new values.

The attached patch (my first BP one!) resolves the issue in my limited testing. It moves the $old_values definition to before the field is updated.

Attachments (1)

5755.patch (1.7 KB) - added by Viper007Bond 5 years ago.

Download all attachments as: .zip

Change History (6)

@Viper007Bond
5 years ago

#1 @DJPaul
5 years ago

  • Milestone changed from Awaiting Review to 2.1

#2 @djpaul
5 years ago

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

In 8630:

xProfile: when a user's profile is updated, correctly pass the fields' previous values to the xprofile_updated_profile action.

Fixes #5755, props Viper007Bond

#3 @djpaul
5 years ago

In 8631:

xProfile: when updating a user profile, make sure the actions are passed the field's current (new) value.

Previously, we've been passing these actions the values that we've told xProfile to set, instead of the
field's actual (new) value. Most of the time, these will be identical, but with BP 2.0's xProfile field
type improvements, there are more lower-level places where the value could be filtered before the data's
written to the database.

In this situation, the field's actual new value could be different from what we've been returning in the
xprofile_profile_field_data_updated and xprofile_updated_profile actions.

See #5755

#4 @DJPaul
5 years ago

Thanks for the patch, Viper007Bond, and congrats on your first BuddyPress props. :)

#5 @djpaul
5 years ago

In 8691:

xProfile: when a user's profile is updated, correctly pass the fields' previous values to the xprofile_updated_profile action.

Fixes #5755 (branch), props Viper007Bond

Note: See TracTickets for help on using tickets.