[buddypress-trac] [BuddyPress Trac] #5630: Enable BP_XProfile_Field_Type classes to register display filter
buddypress-trac
noreply at wordpress.org
Fri May 9 21:28:04 UTC 2014
#5630: Enable BP_XProfile_Field_Type classes to register display filter
--------------------------+-----------------------------------
Reporter: boonebgorges | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.1
Component: XProfile | Version:
Severity: normal | Keywords: has-patch 2nd-opinion
--------------------------+-----------------------------------
It makes sense that xprofile field types should be able to apply custom
filters to their output value. We currently do this in BP in an ad hoc
way, using the `'bp_get_the_profile_field_value'` filter. See eg
https://buddypress.trac.wordpress.org/browser/tags/2.0.1/bp-xprofile/bp-
xprofile-filters.php#L118
Now that we have `BP_XProfile_Field_Type`, maybe we can do better. My
suggestion: If a field type class has a method `display_filter()`, we
automatically apply it to the output of fields of that type. The attached
patch has a suggested approach. It's a rough draft - `ReflectionClass`
objects created in this way should be cached, function naming is up for
debate, etc. But it demonstrates how we might move the formatting for one
specific core field type (datebox) into the class, and gestures toward
richer formatting possibilities for other field types. See eg #5501.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5630>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list