Opened 7 years ago
Closed 7 years ago
#7664 closed defect (bug) (fixed)
Redirect back to the edit screen to display the updates and message
Reported by: | carlo.tafuro | Owned by: | djpaul |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 2.9.2 |
Component: | Extended Profile | Keywords: | |
Cc: | carlo.tafuro@… |
Description
Hello,
after the line:
bp_core_add_message( __( 'Please make sure you fill in all required fields in this profile field group before saving.', 'buddypress' ), 'error' );
in bp-xprofile/bp-xprofile-screens.php
is missing:
// Redirect back to the edit screen to display the updates and message. bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . bp_action_variable( 1 ) ) );
like at the end of the same function xprofile_screen_edit_profile()
without that line the error message is displayed on the next page.
Thanks
Carlo
Change History (6)
#1
@
7 years ago
- Component changed from Core to Extended Profile
- Milestone changed from Awaiting Review to 2.9.3
#2
@
7 years ago
To reproduce, you need to authenticate as a non-admin user and have two profile fields: one optional, one required. I used textboxes.
Submit the edit form with values for both fields. When the page reloads on the edit screen showing the success message, change the value for the optional field to something you'll remember, and clear the value entirely from the required field.
What should happen is that you are presented with a message saying "check all required fields are filled in", and the values of both fields show their original, pre-saved values.
What actually happens is, you are presented with that message, but both profile field values have been updated as per the values you entered into the form: the "required" field has no value set(!).
The fix is as Carlo has described.
This ticket was mentioned in Slack in #buddypress by djpaul. View the logs.
7 years ago
#4
@
7 years ago
Hi @DJPaul,
the required field seems to have no value set, but if you reload the page you see that the value remains unchanged, so there is no problem of bypassing required form fields.
#5
@
7 years ago
- Milestone changed from 2.9.3 to 3.0
Hi again @carlo.tafuro!
Exactly - it took me an hour, but I remembered it works like that because it would annoy people if they wrote in lots of profile fields, but forgot one required field, and then lost all their changes. :) What I'm going to do is change the error message currently shown to make this more obvious, and look into changing required form fields to have the HTML "required" attribute which would avoid this all together.
Hi @carlo.tafuro
This is an excellent bug report, thank you for letting us know.