WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#19237 closed defect (bug) (fixed)

admin_notices clutter the new about.php, freedoms.php, credits.php admin pages

Reported by: devinreams Owned by: nacin
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.3
Component: Administration Keywords: has-patch dev-feedback
Focuses: Cc:

Description

Regarding the new about.php et al, I'm not sure if you think this should be in another ticket like #18742 but, since the h2 for the page (nav-tab-wrapper) doesn't show up until the middle of the page (in the form of tabs) instead of intended at the top of the page, all admin_notices get cluttered up down here.

Perhaps we change the h2s to h3 and update the styles? That way the notices don't clutter the content.

(this may be an opportunity to standardize on the tabbed styles for multisite, see site-info.php)

Diff attached, didn't take a stab at the styles yet as I wasn't sure if I would nab it all correctly.

Attachments (4)

admin-screens-h3-tabs.diff (2.0 KB) - added by devinreams 2 years ago.
Switching h2s for admin page tabs to h3 to demonstrate admin_notice placement
remove-all-notices.txt (1.7 KB) - added by devinreams 2 years ago.
Removing all notices from the special informational wp-admin pages
19237.diff (1.5 KB) - added by nacin 2 years ago.
hide-notices-with-css.diff (407 bytes) - added by devinreams 2 years ago.

Download all attachments as: .zip

Change History (17)

devinreams2 years ago

Switching h2s for admin page tabs to h3 to demonstrate admin_notice placement

comment:1 SergeyBiryukov2 years ago

  • Milestone changed from Awaiting Review to 3.3

comment:2 nacin2 years ago

Tempted to avoid these hooks for these special pages. That screen is a mess with notices.

We need Menu Humility for plugin notices. Looking at you, Automattic.

comment:3 devinreams2 years ago

I thought about removing the hooks, too.

Then, I wasn't sure if it wen't against the point of having these universal hooks (e.g.: a theme or plugin dev may intentionally want to add a notice on the 'About' page, perhaps?).

comment:4 griffinjt2 years ago

If users venture to any of these pages, I doubt they are concerned about the current admin notices that barrage them on every other screen. I'd be a fan of removing admin notices from these pages, too.

devinreams2 years ago

Removing all notices from the special informational wp-admin pages

comment:5 devinreams2 years ago

  • Owner set to devinreams
  • Status changed from new to accepted

OK, so I'm fairly convinced there's no good reason to show notices on these pages at all. So: remove all of them! (and don't touch the fancy h2's).

Attaching to remove_all_actions to all admin notices (in order seen in admin-header.php) to these 3 pages (about, credits, freedoms).

comment:6 devinreams2 years ago

  • Keywords dev-feedback added; needs-patch removed

comment:7 nacin2 years ago

Clever. I didn't think about using remove_all_actions(). Unfortunately this means that any notices that get attached on admin_head or some hook in admin-header.php would still appear. Here's an alternative hack.

nacin2 years ago

comment:8 nacin2 years ago

#19306 for remove_all_actions().

comment:9 jane2 years ago

Gave my thumbs up to @nacin in irc the other day on removing all notices on the post-update screen. Just documenting here as well.

comment:10 devinreams2 years ago

  • Owner changed from devinreams to nacin
  • Status changed from accepted to assigned

@nacin, do you want to stick with my patch (brute-force remove the notices) or go another route? I'm happy to help either way...

comment:11 nacin2 years ago

devinreams pointed out that 19237.diff didn't cover all_admin_notices. It was also pointed out that CSS might be doable here, since the notices are specifically being moved to be with the h2s based on class-targeting. Essentially:

/* added to 22.0 - About Pages, wp-admin.dev.css */
.about-wrap div.updated,
.about-wrap div.error {
    display: none;

Any code that does not use these classes will still appear, but at the very top of the page.

Devin, if this works for you (since you have a testbed full of them), can you turn that into a patch?

comment:12 devinreams2 years ago

OK, fair enough.

Added !important because some (like VaultPress) plugins.css can come in later with their own display:block, for instance.

comment:13 nacin2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In [19393]:

Hide admin notices on the about/credits/freedoms screens. props devinreams, fixes #19237.

Note: See TracTickets for help on using tickets.