WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#16238 closed defect (bug) (fixed)

convert_to_screen() doesn't support network/user admin

Reported by: kawauso Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

The new Network and User dashboards use the -network and -user slugs respectively in the screen ID.

When using add_contextual_help() in the context of a plugin, developers are likely to be using the string result of add_submenu_page(). This is passed to convert_to_screen() and is always treated as having no specific context, resulting in the contextual help not being displayed outside of the standard dashboard. The same is likely to apply for other uses of convert_to_screen().

Attachments (3)

16238.diff (615 bytes) - added by kawauso 3 years ago.
Assume current dashboard as context (since the dashboards have individual menu hooks, plugins shouldn't be trying to add menus of context)
16238.2.diff (706 bytes) - added by kawauso 3 years ago.
Respect existing dashboard suffixes
16238.3.diff (684 bytes) - added by nacin 3 years ago.

Download all attachments as: .zip

Change History (11)

kawauso3 years ago

Assume current dashboard as context (since the dashboards have individual menu hooks, plugins shouldn't be trying to add menus of context)

comment:1 kawauso3 years ago

  • Keywords has-patch added

comment:2 nacin3 years ago

  • Milestone changed from Awaiting Review to 3.1

Looks good.

comment:3 ryan3 years ago

Let's make sure we don't end up with -network-network if the passed string is already suffixed.

kawauso3 years ago

Respect existing dashboard suffixes

comment:4 kawauso3 years ago

New patch to respect existing suffixes passed. More flexible than just stripping them out in the str_replace().

nacin3 years ago

comment:5 kawauso3 years ago

nacin: Looked at that method, but it can result in a slug such as myplugin-user-network, which would work for purposes of preventing loads on the wrong page, but would be an invalid id slug.

comment:6 nacin3 years ago

Suggest commit on 16238.diff (after talking with ryan).

comment:7 markjaquith3 years ago

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

(In [17318]) Append -network or -user suffix in convert_to_screen(). props kawauso. fixes #16238

comment:8 ocean903 years ago

Related: #16348

Note: See TracTickets for help on using tickets.