Make WordPress Core

Opened 4 months ago

Last modified 9 days ago

#44981 assigned enhancement

Make notice on Privacy Policy page to 'Check out our guide' dismissable

Reported by: garrett-eclipse Owned by: garrett-eclipse
Milestone: Future Release Priority: normal
Severity: normal Version: 4.9.6
Component: Privacy Keywords: has-patch has-screenshots dev-feedback needs-testing
Focuses: Cc:


This ticket branches from #44669 with this comment from @norcross; https://core.trac.wordpress.org/ticket/44669?replyto=4#comment:4

The notice reference can be found here; https://github.com/WordPress/WordPress/blob/f7ba175491b725a5f3d636072c8b432774d38ae3/wp-admin/includes/misc.php#L1613-L1629

With this notice the is-dismissable class could be added; https://codex.wordpress.org/Plugin_API/Action_Reference/admin_notices

If a new Privacy Policy page is created this notice should re-appear until dismissed.

Attachments (4)

0Yv8SNzA.png (97.3 KB) - added by garrett-eclipse 4 months ago.
Notice to make dismissable
44981.diff (499 bytes) - added by garrett-eclipse 4 months ago.
Make notice dismissable
44981.2.diff (1.1 KB) - added by garrett-eclipse 11 days ago.
Screen Shot 2019-01-09 at 10.53.57 PM.png (44.4 KB) - added by garrett-eclipse 11 days ago.
Notice w/ Close Button

Download all attachments as: .zip

Change History (16)

4 months ago

Notice to make dismissable

4 months ago

Make notice dismissable

#1 @garrett-eclipse
4 months ago

  • Keywords has-patch added

Added the .is-dismissable class to the privacy policy notice.

#2 @garrett-eclipse
4 months ago

  • Owner set to garrett-eclipse
  • Status changed from new to assigned

#3 @garrett-eclipse
3 months ago

  • Milestone changed from Awaiting Review to 5.0.1
  • Version set to 4.9.6

#4 @pento
6 weeks ago

  • Milestone changed from 5.0.1 to 5.0.2

#5 @pento
5 weeks ago

  • Milestone changed from 5.0.2 to 5.0.3

#6 @audrasjb
3 weeks ago

  • Keywords commit added

This ticket is triaged in milestone 5.0.3. The patch looks good, small and self-contained enough to land in the next minor. Adding commit keyword to see if it can land in 5.0.3.

#7 @desrosj
2 weeks ago

  • Milestone changed from 5.0.3 to 5.1

This falls outside the 5.0.3 scope (block editor related updates, major bugs, regressions), so let's tackle it in 5.1.

#8 @pento
12 days ago

  • Keywords commit removed

This patch doesn't add the close button for me. @garrett-eclipse, could you investigate, please?

#9 @pento
11 days ago

  • Keywords needs-refresh added
  • Milestone changed from 5.1 to Future Release

11 days ago

Notice w/ Close Button

#10 @garrett-eclipse
11 days ago

  • Keywords has-screenshots dev-feedback needs-testing added; needs-refresh removed

Thanks @pento,

Sorry about that, had it working in /build and hadn't applied to /src before making that original diff.

Latest patch is correct with proper spelling of is-dismissible class and calls makeNoticesDismissible on wp-pp-notice to invoke the function to inject the button.

Minor notes; Upon reload the notice will re-appear which is expected. As well just this was started pre-5.0 so this notice currently only displays with Classic Editor enabled.

Please apply the latest and let me know if there's any issues.

#11 @pento
10 days ago

Thank you for refreshing the patch, @garrett-eclipse.

I think it needs to remember that the notice has been dismissed. As you noted, refreshing the page makes it reappear, which includes when you click "Save Draft". A dismissed notice that keeps coming back is a more frustrating experience than a non-dismissable notice. 😉

#12 @garrett-eclipse
9 days ago

Thanks for the feedback @pento I tend to agree would be nice to save the dismissed state of the notice there.

I can definitely work on that functionality but am hoping for a little direction if you don't mind. To keep the notice dismissed I would be adding a flag either as a Cookie, Session data or User Meta and am wondering if there's an existing standard (maybe an example) for this in core?

As well whatever storage method is used I feel should get cleared when the policy text has changed so as to re-introduce the guide link. If I do that it would make sense to be done here along side the policy_text_changed_notice notice which re-appears on the privacy.php screen. And by here I mean - https://github.com/WordPress/WordPress/blob/51155f3989c29bbae5322b6cba58952a7c58b0ba/wp-admin/includes/misc.php#L1428

I'm leaning towards using User Meta over Cookie/Session data as it pertains across browsers/devices and is a more permanent dismissal but would love your thoughts.


Note: See TracTickets for help on using tickets.