[buddypress-trac] [BuddyPress Trac] #5501: Custom xprofile field: URL

buddypress-trac noreply at wordpress.org
Thu Jul 17 10:38:16 UTC 2014


#5501: Custom xprofile field: URL
-------------------------------------+------------------
 Reporter:  sooskriszta              |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  high                     |   Milestone:  2.1
Component:  XProfile                 |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  needs-patch 2nd-opinion  |
-------------------------------------+------------------

Comment (by boonebgorges):

 > I would very much like to see r8638 moved out of xprofile_set_field_data
 and into a field type class/hooked to a field type class, something like
 Boone suggests.

 +1. Though I'm guessing that committing it in the first place was a
 mistake on jjj's part - the commit message does not accurately describe
 what the change does.

 > Oh, and if that HTTP validation regex wasn't so ridiculously huge and
 un-readable (it looks like the protocol is optional), having that require
 a protocol would have been the easy way to fix this. :)

 That's not really true though. If an input doesn't pass the `is_valid()`
 check, it's simply rejected. What r8638 is supposed to do (though I have
 not tested whether it actually does) is to catch input *before* it is
 tested by `is_valid()`, make an educated guess about what the user
 "meant", and then modify it so that it does pass validation. The
 motivation here is that people are used to being able to enter URLs
 without the protocol, so we want to be able to accept it as a valid input
 even though the value we save always has a protocol. (Also, the regex
 *does* in fact require a protocol, assuming I read it correctly: in
 `(?:https?|ftp)` the `?:` means that this is a non-captured group, not
 that it's optional.)

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


More information about the buddypress-trac mailing list