Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#27223 closed enhancement (fixed)

do_action( 'admin_head' ) is missing in sites.php

Reported by: wpidiots's profile wpidiots Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.8.1
Component: Networks and Sites Keywords: has-patch
Focuses: multisite Cc:

Description (last modified by SergeyBiryukov)

Hi guys,

We should add a hook in /network/sites.php as we have do_action( 'login_head' ) in wp-login.php

Current wpmuadminedit hook is not enough because it's placed above the <html>

Attachments (1)

27223.diff (1.7 KB) - added by jeremyfelt 10 years ago.

Download all attachments as: .zip

Change History (12)

#1 @johnbillion
10 years ago

  • Keywords reporter-feedback added

As you can tell by its name, the login_head action is meant for the login screen. Why would you want this fired on one particular network admin screen? What's your use case?

There are two hooks fired in the head of this screen: the specific admin_head-sites.php hook and the more generic admin_head hook (which is fired in the head of every admin screen).

#2 @wpidiots
10 years ago

There isn't any way I am aware of to apply custom CSS on that particular page without the hook within html, head or body tag.

#3 @SergeyBiryukov
10 years ago

There are plenty of hooks in admin-header.php: tags/3.8.1/src/wp-admin/admin-header.php#L71.

For that particular page, use admin_print_styles-sites.php or admin_head-sites.php.

#4 @wpidiots
10 years ago

Sorry, I wasn't clear enough.

Those hooks work perfectly on the sites.php but they don't work on the page when I want to delete a site (still sites.php but with additional args)

So for instance, if I click on this link I am not able to call a function on the hooks you mentioned http://localhost/test/wp-admin/network/sites.php?action=confirm&action2=deleteblog&id=9&msg=You+are+about+to+delete+the+site+%2Ftest%2Fasdasdsa%2F.&_wpnonce=89901bde5b

I tested and init or shutdown work well.

#5 @SergeyBiryukov
10 years ago

  • Keywords needs-patch added; reporter-feedback removed
  • Milestone changed from Awaiting Review to 3.9

Yeah, that confirmation screen doesn't have any admin_head-like hooks:
tags/3.8.1/src/wp-admin/network/sites.php#L65

We should add them, as we did for Press This in [25131].

#6 follow-up: @SergeyBiryukov
10 years ago

Or, we should turn that screen into a regular admin page, with navigation, header and footer.

#7 @SergeyBiryukov
10 years ago

  • Description modified (diff)
  • Summary changed from do_action( 'login_head' ) is missing in sites.php to do_action( 'admin_head' ) is missing in sites.php

#8 @wpidiots
10 years ago

Thanks!

@jeremyfelt
10 years ago

#9 in reply to: ↑ 6 @jeremyfelt
10 years ago

  • Keywords has-patch added; needs-patch removed

Replying to SergeyBiryukov:

Or, we should turn that screen into a regular admin page, with navigation, header and footer.

This makes the most sense, IMO.

27223.diff takes this approach and wraps the confirm site deletion output in standard admin pieces, providing access to various actions in the process.

#10 @SergeyBiryukov
10 years ago

"Confirm your action" should be translatable, but otherwise 27223.diff looks good to me.

#11 @SergeyBiryukov
10 years ago

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

In 27348:

Display site deletion confirmation as a regular admin page.

props jeremyfelt.
fixes #27223.

Note: See TracTickets for help on using tickets.