Make WordPress Core

Opened 16 years ago

Closed 15 years ago

#9438 closed defect (bug) (fixed)

Some Hook names are localized and therefore rendered useless

Reported by: hakre's profile hakre Owned by:
Milestone: 2.8 Priority: high
Severity: blocker Version: 2.7.1
Component: Administration Keywords: has-patch tested commit
Focuses: Cc:

Description

Some Hook Names are localized. For Example the string "settings" will be translated to "einstellungen". Something goes horribly wrong because of that, Hook Names are not consistent when WordPress is beding localized (which is normal).

The HookName I stumbeled over:
"einstellungen_page_breadcrumb-navxt"

This seems to be related with registering Submenu Pages.

Attachments (3)

9438-localization-removed.patch (464 bytes) - added by hakre 16 years ago.
a simple change removes the localization.
9438.diff (888 bytes) - added by Denis-de-Bernardy 15 years ago.
9438.2.diff (361 bytes) - added by coffee2code 15 years ago.
Adds missing back-compat mapping

Download all attachments as: .zip

Change History (18)

#1 @hakre
16 years ago

I could dig in a bit more. This falls on my feet again. This makes the development of a Plugin Page complicated since you can not gain knowlege about the name of the hook in development.

this is where the localized name is coming from (global array):
$admin_page_hooks[$parent]

this is in get_plugin_page_hookname() in wp-admin/includes/plugin.php

this array is filed off from the menu array which is defined in wp-admin/menu.php

the solution is quite easy. there only needs a little fix in assigning the name there. instead of taking a localized string, I suggest to take the name of the actual php file, the extension removed.

@hakre
16 years ago

a simple change removes the localization.

#2 @hakre
16 years ago

  • Keywords has-patch added
  • Summary changed from Some Hook names are localized by accident to Some Hook names are localized and therefore rendered useless

#3 @hakre
16 years ago

Hookname before patch: "einstellungen_page_breadcrumb-navxt"
Hookname after patch: "options-general_page_breadcrumb-navxt"

that is a german localized wordpress, this is a admin_page_hook in the breadcrumb plugin.

#4 @hakre
16 years ago

Hookname before patch: "einstellungen_page_breadcrumb-navxt"

Hookname after patch: "options-general_page_breadcrumb-navxt"

that is a german localized wordpress, this is a admin_page_hook in the breadcrumb plugin.

#5 @Denis-de-Bernardy
15 years ago

  • Keywords tested added
  • Milestone changed from 2.7.2 to 2.8

#6 @Denis-de-Bernardy
15 years ago

  • Keywords commit added

#7 @ryan
15 years ago

I seem to recall some plugins breaking last time we tried to fix this, but I am not certain. I tested this with my usual menu testing plugins and all was well, so let's try this out for 2.8 and be wary of reports of plugins breaking.

#8 @ryan
15 years ago

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

(In [11017]) Use unlocalized hook name. Props hakre. fixes #9438

#9 @Denis-de-Bernardy
15 years ago

thank you so much... this was *sooooo* annoying, because it rendered those functions essentially useless. :-)

#10 @Denis-de-Bernardy
15 years ago

  • Resolution fixed deleted
  • Severity changed from critical to blocker
  • Status changed from closed to reopened

original patch breaks a few plugins. fix attached

#11 @ryan
15 years ago

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

(In [11032]) Hook name back-compat from Denis-de-Bernardy. fixes #9438

#12 @hakre
15 years ago

thanks.

#13 @coffee2code
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

The backwards compatibility fixes added in r11032 is missing the mapping of : 'themes' => 'appearance'

Patch 9438.2.diff is attached.

@coffee2code
15 years ago

Adds missing back-compat mapping

#15 @ryan
15 years ago

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

(In [11113]) More hook back-compat. Props coffee2code. fixes #9438

Note: See TracTickets for help on using tickets.