PROD-10311 - #5029
Conversation
…ter set The Bio field is shared with each member's WordPress "Biographical Info" (usermeta `description`), which is why it shipped as a one-per-site field: two of them would write to the same user meta key. A repeater field set produces exactly that — a hidden template field plus one clone per repeat set, every one of them a `biography` field pointing at the same meta. The result on a site that made the combination: each profile save wrote the joined text of all the member's sets onto the template field, the Bio sync mirrored that into their WordPress bio, and the field rendered a second time on Edit Profile holding text the member never typed. This closes both orders in which the combination can be created. - Refuse a Bio field entering a repeater set in `BP_XProfile_Field::save()`. Every field write reaches it through `xprofile_insert_field()`, so REST, WP-CLI and third-party callers are covered, not only the admin screen. Entry only — a Bio field already sitting in such a set stays editable, so an admin cleaning one up is not left without a way to work on the field. - Refuse switching the repeater on for a set that already holds a Bio field, in `BP_XProfile_Group::save()`, so the legacy `group_is_repeater` POST path and the public `xprofile_insert_field_group()` API are covered too. Only the off->on transition is refused: forcing an already-repeating set off would expose every clone field on member profiles. - Surface both refusals as messages in the Settings 2.0 handler; `save()` returns a bare false, matching the singleton guard beside it. The field-side message is limited to the entering case so an edit failing for another reason is not told it "cannot be added". - Add `bb_xprofile_is_repeater_group()` and `bb_xprofile_group_has_bio_field()` so the repeater meta keys stay owned by the repeater code rather than being re-derived at each call site.
…only entry The first pass blocked a Bio field entering a repeating set — creating one there, or moving one in — and deliberately let an existing one still be edited, so an admin cleaning up such a set kept a way to work on the field. That left a hole: a Bio field written straight to the database sits in the same invalid state as one added through the admin, but re-saving it was accepted without comment. Refuse every save instead. One rule, one message, and the state cannot be quietly kept alive by saving over it. Deleting the field, or switching the repeater off, remains the way out. - Drop the entry/edit detection from `BP_XProfile_Field::save()`, along with the extra query it needed to compare the field's current field set. - Drop the matching condition from the Settings 2.0 handler and reword the message for both cases: "cannot be used in a repeater field set … Move it to a field set that does not repeat."
|
Claude finished @jitendrabanjara1991's task in 6m 22s —— View job Review complete — PROD-10311 (fresh review, ignoring prior review threads)Todo list
Root causeThe Bio field ( How the two commits work together
SQL-inserted BIO scenario — traced end to end
I also traced this beyond the Settings 2.0 AJAX path, since the guard lives in the model layer (
Regression / side-effect check (things that must NOT be blocked)
Other things verified
Remaining, non-blocking observations (carried forward / refined from prior context)
Final verdict: ApproveThe fix correctly targets the root cause (Bio is a WordPress-singleton value that can't safely be cloned by a repeater) and, with the second commit, correctly guarantees that a Bio field already sitting in an invalid repeater-set state — however it got there, including direct SQL — is preserved unmodified on the next save rather than silently accepted or partially overwritten. I did not find any path that blocks a legitimate, unrelated save, and the escape hatch (disabling the repeater) keeps the set recoverable. Adding a regression test for the preservation scenario would be valuable but is not blocking. |
Jira Issue:
https://buddyboss.atlassian.net/browse/PROD-10308
https://buddyboss.atlassian.net/browse/PROD-10311
General Note
Keep all conversations related to this PR in the associated Jira issue(s). Do NOT add comment on this PR or edit this PR’s description.
Notes to Developer
Notes to Reviewer