Make WordPress Core

Opened 3 years ago

Closed 3 weeks ago

#59276 closed defect (bug) (fixed)

Wrong notice is showing up on the Privacy Policy page settings in WP dashboard.

Reported by: anveshika Owned by: joedolson
Priority: normal Milestone: 7.1
Component: Privacy Version:
Severity: normal Keywords: 2nd-opinion has-patch
Cc: Focuses: ui

Description

If Admin does not select any page for Privacy policy from the Admin Dashboard and save the settings, the notice that appears shows that the page has been updated.

How to reproduce:

  1. Navigate to Settings > Privacy.
  2. Keep 'Change your Privacy Policy page' dropdown unselected.
  3. Save settings by clicking on 'Use This Page' button.

Expected Result:
As there is no page selected in dropdown, it should not show the notice that page has been updated.

https://ibb.co/3hyK6BY

Environment Details:

WordPress version: 6.3.1
Browser: Chrome Version 116.0.5845.111
OS version: Windows 10
PHP version: 7.4.33
Server: Apache/2.4.57
Active Theme: Twenty Twenty-Three
Active Plugins: None

Attachments (1)

privacy.jpg (163.8 KB ) - added by anveshika 3 years ago.

Download all attachments as: .zip

Change History (12)

@anveshika
3 years ago

#1 @audrasjb
3 years ago

  • Component AdministrationPrivacy
  • Focuses ui added
  • Keywords 2nd-opinion added
  • Version 6.3.1

Hello! Welcome to WordPress Core Trac and thanks for opening this ticket!

For what it's worth I'm unsure this really is an issue as when you select no privacy policy page and save your settings, you technically update the setting, and even more if you previously used to have a selected privacy policy page and finally decide to not have any privacy policy page.

Of course, we could also change a bit the message to say "Privacy policy page removed." but technically, the setting was just updated to 0, so I'd say the current message is not 100% wrong :)

Thoughts?

#2 @anveshika
3 years ago

Hi @audrasjb , Thanks for checking this ticket. I agree with your opinion about the message. I think it will make more sense if the message says 'Privacy Policy Page removed successfully.'

Please share your thoughts on this.

#3 @masteradhoc
3 months ago

Hey @audrasjb / @anveshika,

This came to my attention while reviewing open Privacy component tickets. I agree the current message isn't 100% correct. But to make it more precise we'd need to make three notes:

  • If a page was selected → "Privacy Policy page updated successfully."
  • If a previously set page was cleared → "Privacy Policy page removed."
  • If no page was set before and none is set now → "No Privacy Policy page is set."

The fix is small — reading the previous option value before saving and branching the message accordingly. Happy to put together a patch if there's appetite for it. But not sure its worth it / has a huge benefit. @audrasjb what do you think?

This ticket was mentioned in PR #12247 on WordPress/wordpress-develop by @micahele.


8 weeks ago
#4

  • Keywords has-patch added; needs-patch removed

## Summary

Fixes #59276.

On Settings → Privacy, saving the Privacy Policy page setting always displayed *"Privacy Policy page updated successfully."* — even when no page was selected. This is misleading both when clearing a previously set page and when saving with no page selected and none set before.

### Reproduction

  1. Go to Settings → Privacy
  2. Leave the *Change your Privacy Policy page* dropdown on *— Select —*
  3. Click Use This Page
  4. Notice incorrectly reads *"Privacy Policy page updated successfully."*

## The fix

options-privacy.php now reads the previous option value before saving and branches the notice accordingly, following the behavior outlined by reviewers on the ticket:

Scenario Notice Type
A page is selected "Privacy Policy page updated successfully." (unchanged) success
A previously set page is cleared "Privacy Policy page removed." success
No page before, none now "No Privacy Policy page is currently set." info

The existing "update your menus" variant for published pages is preserved.

## Testing

Verified all three scenarios end-to-end on the local Docker environment (Settings → Privacy):

Action Resulting notice
Select a page → *Use This Page* Privacy Policy page updated successfully. (success)
Clear a previously set page Privacy Policy page removed. (success)
Save with no page selected/none set (the reported bug) No Privacy Policy page is currently set. (info)
  • PHP lint: clean
  • PHPCS (phpcs.xml.dist): clean

The logic lives in the options-privacy.php admin page script (consistent with how other options-*.php pages build their add_settings_error() messages), so no unit test is added, matching existing conventions for these page scripts.

@masteradhoc commented on PR #12247:


5 weeks ago
#5

Thanks @MicahelE for the PR - appreciate it. We havent yet decided if we should go with a more generic string when saving or splitting as alternativ suggestion in https://core.trac.wordpress.org/ticket/59276#comment:3

Anyhow tested the PR now in case we want to go this route.

Option A
1) not set privacy policy
2) save without doing something
https://github.com/user-attachments/assets/25dccc25-e9b6-4af7-b405-c9c7cc8bf731

Option B
1) not set privacy policy
2) save new privacy policy page
https://github.com/user-attachments/assets/26ab6541-96f2-4483-a5bb-f6f1df4341df

Option C
1) privacy policy is already set
2) replace "none" - so remove it
https://github.com/user-attachments/assets/273969c2-2c94-4308-8203-2708cba3009b

PR works well for me. thanks for your work!

#6 @masteradhoc
5 weeks ago

  • Milestone Awaiting Review7.1

Moving this to Milestone 7.1 to get the patch tested by more people and eventually merged for 7.1. Patch looks good to me.

This ticket was mentioned in Slack in #core by adrianduffell. View the logs.


3 weeks ago

#8 @joedolson
3 weeks ago

  • Owner set to joedolson
  • Status newaccepted

#9 @adrianduffell
3 weeks ago

This was discussed in today's bug scrub. This could still make it in the 7.1 beta, but the PR needs a review.

Last edited 3 weeks ago by adrianduffell (previous) (diff)

#11 @joedolson
3 weeks ago

  • Resolutionfixed
  • Status acceptedclosed

In 62844:

Privacy: More accurate admin notices when saving.

When saving Privacy Policy page settings, show a notice that indicates there is no Privacy Policy page set instead of "Privacy Policy page updated successfully" if no page is selected. Differentiate between removing the current page and saving settings with no changes.

Developed in https://github.com/WordPress/wordpress-develop/pull/12247

Props anveshika, audrasjb, masteradhoc, micahele, adrianduffell, pedrofigueroa1989, joedolson.
Fixes #59276.

Note: See TracTickets for help on using tickets.