Opened 11 years ago
Closed 11 years ago
#5237 closed defect (bug) (fixed)
BuddyPress arbitrarily changes user field type
Reported by: | sgr33n | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 1.9 | Priority: | highest |
Severity: | blocker | Version: | |
Component: | Extended Profile | Keywords: | |
Cc: |
Description
To reproduce:
Create a new user field datebox.
Then modify this field, changing default visibility. The field will become textbox, without the chance to change it back, except acting directly on the database.
Change History (3)
Note: See
TracTickets for help on using
tickets.
Confirmed.
There are two parallel bugs, which have been uncovered by [7419]. See #4947.
Previously,
can_delete
was never being set, because of an oversight in the way profile fields were saved. Since [7419], this problem is fixed. But now new fields havecan_delete
set to 0 (which is what the null value becomes when run through$wpdb->prepare( '%s' )
) instead of null. As a result, newly created fields are being set tocan_delete = 0
. This is incorrect: the only purpose ofcan_delete
, from the point of view of BP core, is to prevent users from deleting field #1, the fullname field. We don't even have UI for changing that setting. The solution to this problem is to ensure thatBP_XProfile_Field
objects have a defaultcan_delete
value of 1; the fullname field will still be created withcan_delete = 0
bybp_core_install_extended_profiles()
.The separate bug, which is more directly related to this ticket (though is secondary to the first bug in a way), is that the secondary fields on the profile field edit panel are currently hidden when
'0' == $this->can_delete
. Again, the intent of this is to ensure that you can't change the visibility, etc of the Fullname field, but it's implemented in an overbroad way, since fields other than 1 might havecan_delete = 0
, but there's no reason why you shouldn't be able to edit visibility, field type, etc. The solution to this problem is to hide the additional fields when the field_id = 1, rather than when can_delete = 0 - a more targeted check.