WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#10008 closed defect (bug) (wontfix)

var pagenow in js not supporting plugins !

Reported by: arena Owned by:
Milestone: 2.8.5 Priority: high
Severity: normal Version: 2.8
Component: Administration Keywords: has-patch reporter-feedback
Focuses: Cc:

Description

javascript generated in the admin header do not support plugins

so modifiying this line

var pagenow = '<?php echo substr($pagenow, 0, -4); ?>';

into this

var pagenow = '<?php echo (isset($plugin_page)) ? $plugin_page : substr($pagenow, 0, -4); ?>';

Attachments (1)

#10008.diff (870 bytes) - added by arena 5 years ago.
see ticket text !

Download all attachments as: .zip

Change History (12)

arena5 years ago

see ticket text !

comment:1 follow-up: Denis-de-Bernardy5 years ago

shouldn't this be substr($page_hook, 0, -4), rather?

comment:2 in reply to: ↑ 1 ; follow-up: arena5 years ago

  • Keywords tested added; needs-testing removed

Replying to Denis-de-Bernardy:

shouldn't this be substr($page_hook, 0, -4), rather?

No, in wp, pagenow is deducted from the php file name (admin.php, post.php etc ...)

in plugins, plugin pages have no relation with any php file (admin.php?page=toto ...)

comment:3 in reply to: ↑ 2 arena5 years ago

Replying to arena:

Replying to Denis-de-Bernardy:

shouldn't this be substr($page_hook, 0, -4), rather?

No, in wp, pagenow is deducted from the php file name (admin.php, post.php etc ...)

in plugins, plugin pages have no relation with any php file (admin.php?page=toto ...)

btw, plugin_page is more stable than page_hook, page_hook value changes whether the option is at the top of a plugin menu or not !

comment:4 azaozz5 years ago

pagenow is needed for managing table columns, adding $hook_suffix seems better.

comment:5 azaozz5 years ago

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

(In [11508]) Add $hook_suffix as js var, fixes #10008

comment:6 arena5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

2.8.2 regression

[11508] has been discarded !!!

comment:7 arena5 years ago

  • Milestone changed from 2.8 to 2.8.3

changing milestone

comment:8 arena5 years ago

sorry, forget about [11508], #10008.diff is still pending

comment:9 dd325 years ago

sorry, forget about [11508], #10008.diff is still pending

I believe the decision here is for $pagenow to be mimicked in JS, Its never set to the pagehook in PHP. If a plugin needs the plugin pagehook, they can use adminpage.

Do you have any arguments against that that would support it not being mimicked?

comment:10 scribu5 years ago

  • Keywords reporter-feedback added; tested removed

comment:11 arena5 years ago

  • Resolution set to wontfix
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.