Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 8 years ago

Last modified 8 years ago

#6086 closed defect (bug) (fixed)

bp_get_the_profile_field_is_required filter has nothing to check against.

Reported by: tw2113's profile tw2113 Owned by: tw2113's profile tw2113
Milestone: 2.8 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch
Cc:

Description

We pass in a boolean value, but we don't pass in anything like the current field that could be used to conditionally change the boolean value we return.

From the looks of it, there would potentially be access to the "$field" global but the user would need to know about that and call it themselves in their hook callback.

Attachments (1)

6086-field-id-hook-params.diff (1.2 KB) - added by tw2113 8 years ago.

Download all attachments as: .zip

Change History (9)

#1 @boonebgorges
10 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

From the looks of it, there would potentially be access to the "$field" global but the user would need to know about that and call it themselves in their hook callback.

Yes, I think this is the reason. A couple considerations:

  • The $field global is an object, and passing it to the filter by reference (as it would be passed by default) may invite developers to do odd things with it. Not functionally different from directly referencing the global, but it makes it a bit more tempting.
  • The format of the $field global is pretty odd and specific to our loop implementation. IMO we should be discouraging reference to it, because it prevents us from making certain kinds of changes to this icky loop in the future.
  • If we're going to make a change to one hook, we should do it in all xprofile template hooks.

How about if we pass the field id, and leave it to the devs to fetch the field object using BP_XProfile_Field? This would mitigate the issues I've described above.

#2 @tw2113
8 years ago

Looked through the file and at least for this one file, these two were the only ones that made sense to need a field id parameter.

#3 @tw2113
8 years ago

  • Milestone changed from Future Release to 2.8

#4 @slaFFik
8 years ago

  • Keywords has-patch added; needs-patch removed

#5 @boonebgorges
8 years ago

  • Owner set to tw2113
  • Status changed from new to assigned

Looks like the patch needs refreshing and the documentation needs updating. Otherwise the change looks good.

#6 @tw2113
8 years ago

Will do, for both this and 7325 a little bit ago.

#7 @tw2113
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 11365:

Adds field IDs to bp_get_the_profile_field_is_required and bp_get_the_profile_field_visibility_level filters.

Fixes #6086.

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


8 years ago

Note: See TracTickets for help on using tickets.