Skip to:

Opened 6 years ago

Closed 6 years ago

#7664 closed defect (bug) (fixed)

Redirect back to the edit screen to display the updates and message

Reported by: carlotafuro's profile carlo.tafuro Owned by: djpaul's profile djpaul
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9.2
Component: Extended Profile Keywords:
Cc: carlo.tafuro@…



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

(see )

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()

(see )

without that line the error message is displayed on the next page.


Change History (6)

#1 @DJPaul
6 years ago

  • Component changed from Core to Extended Profile
  • Milestone changed from Awaiting Review to 2.9.3

Hi @carlo.tafuro

This is an excellent bug report, thank you for letting us know.

#2 @DJPaul
6 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.

Last edited 6 years ago by DJPaul (previous) (diff)

This ticket was mentioned in Slack in #buddypress by djpaul. View the logs.

6 years ago

#4 @carlo.tafuro
6 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 @DJPaul
6 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.

#6 @djpaul
6 years ago

  • Owner set to djpaul
  • Resolution set to fixed
  • Status changed from new to closed

In 11816:

xprofile: adjust message shown to user when submitting xprofile edit form while required fields are empty.

Intended to clarify that the displayed changes are temporary and not saved yet.
We do this because it prevents loss of user data if a lot of changes are made, but a required field has been missed.

Fixes #7664

Thanks to carlo.tafuro for reporting the issue.

Note: See TracTickets for help on using tickets.