Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#36186 closed enhancement (fixed)

users.php and upload.php "Add New" links do not use admin_url()

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.5 Priority: normal
Severity: normal Version: 2.0
Component: Administration Keywords: has-patch 2nd-opinion
Focuses: administration Cc:

Description

Unlike edit.php (and most of the multisite files that use network_admin_url()) both users.php and upload.php use relative file paths when linking to "Add New" in the h1 tag.

This has two implications for edge (but still plausible) use cases, that also in/conveniently coincide with something I'm working on currently:

  • Plugins cannot intercept these URLs to introduce query strings or other functionalities like they can in all other places admin_url() and network_admin_url() are used.
  • Custom wp-admin paths do not obey, as filters applied to admin_url() are not ran

I'd like to propose these two files use admin_url() vs. relative paths, with an imminent patch.

Attachments (2)

Screen Shot 2016-03-09 at 11.50.25 AM.png (41.4 KB) - added by johnjamesjacoby 7 years ago.
Screenshot of the affected links, because describing things is hard
36186.1.patch (1.8 KB) - added by johnjamesjacoby 7 years ago.
Update links to use admin_url() in users.php and upload.php.

Download all attachments as: .zip

Change History (7)

@johnjamesjacoby
7 years ago

Screenshot of the affected links, because describing things is hard

@johnjamesjacoby
7 years ago

Update links to use admin_url() in users.php and upload.php.

#1 @johnjamesjacoby
7 years ago

It's plausible there are many other places through-out wp-admin where relative URLs are presumed safe and appropriate. I have foggy memories of discussions years ago about sweeping through and updating these, and if my foggy memory is to be believed, the remaining stragglers are not intentional or with specific purpose.

I think these 2 places are largely harmless, though, and updating them provides parity with other admin pages and introduces a bit of advanced flexibility for anyone that needs it.

#2 @SergeyBiryukov
7 years ago

In 36901:

Use admin_url() for "Add New" links in wp-admin/upload.php.

Props johnjamesjacoby.
See #36186.

#3 @SergeyBiryukov
7 years ago

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

In 36902:

Use admin_url() for "Add New" links in wp-admin/users.php.

Props johnjamesjacoby.
Fixes #36186.

#4 @SergeyBiryukov
7 years ago

  • Milestone changed from Awaiting Review to 4.5

#5 @johnjamesjacoby
7 years ago

Thanks Sergey, for being so quick with this. I really appreciate it.

Note: See TracTickets for help on using tickets.