[buddypress-trac] [BuddyPress Trac] #5220: Overhaul implementation of xprofile field types

buddypress-trac noreply at wordpress.org
Sun Mar 2 23:08:38 UTC 2014


#5220: Overhaul implementation of xprofile field types
------------------------------------------+-----------------------
 Reporter:  DJPaul                        |       Owner:  DJPaul
     Type:  enhancement                   |      Status:  assigned
 Priority:  normal                        |   Milestone:  2.0
Component:  XProfile                      |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  has-patch dev-feedback early  |
------------------------------------------+-----------------------
Changes (by DJPaul):

 * keywords:  early => has-patch dev-feedback early


Comment:

 I've just put up a first patch for the ticket. You can also compare it to
 trunk over on Github
 https://github.com/paulgibbs/BuddyPress/compare/master...xprofile-types
 and I'd prefer any follow-up patches to be submitted to that `xprofile-
 types` branch as a pull request. But if you want to make a new patch from
 SVN, don't let me stop you -- I can merge manually back to Github, it'd
 just save me some time. Ta.

 This patch is primarily intended to de-duplicate profile field templating
 and validation logic in order to make it easier for core and plugins to
 add new profile field types. Profile field templating was duplicated in
 the registration template, member/profile/edit template, and since
 recently, also in the new wp-admin user profile editor, as well as in
 parts of the wp-admin new/edit profile field screens.

 The approach creates a new class for each profile field type; selectbox,
 textbox, textarea, and so on. They all share an abstract base class
 `BP_XProfile_Field_Type` which abstract away a lot of special behaviour
 that has been added over the years (e.g. some fields accepting null
 values, some accepting multiple default values, and more), and adds true
 field value validation.

 As a demonstration of a new field type, I've implemented a new "Numbers"
 type. It behaves much the same as a regular textbox field does, but only
 accepts numbers. The new unit tests are the best example of how the new
 field value validation can be used.

 I'm looking forward to code review, testing, and feedback.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5220#comment:14>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list