Opened 9 years ago
Closed 8 years ago
#35788 closed defect (bug) (duplicate)
Plugin Editor wrong selected option when file selected
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Plugins | Keywords: | has-patch needs-testing |
Focuses: | ui, administration | Cc: |
Description
Hi there,
I just seen that when you are in the Plugin Editor page of the WP Admin, the selected option in the top right corner (the name of the plugin) is always the first option if you are editing a plugin file.
For example, with Akismet and WooCommerce installed, select WooCommerce and click the readme.txt file (or another one is not the first WooCommerce file). The select show the first option instead of WooCommerce (here Akismet).
I have a tested fix for that.
See the patch file in attachment.
Thank you for your time and advises.
Attachments (3)
Change History (10)
#3
@
9 years ago
Your version worked when choosing a plugin and then selecting a different file for the first time. However if you after the first file change selected an another file from the same plugin, the selected plugin reverted to the wrong one.
This was my first contribution here, so please advise on how to continue from here and what I possibly did wrong. Tried to follow the best practices with the new changes.
#5
follow-up:
↓ 6
@
8 years ago
explode()
isn't really reliable and doesn't solve the root of the problems, which is that $file
and $plugin
are used interchangeably when they in fact shouldn't.
35788.diff correctly passes $plugin
when the main plugin file is needed and $file
when the current file is needed.
This solves quite a few bugs:
- The currently selected plugin is always correct, even when editing files in subdirectories.
- Gets rid of
wp_reset_vars()
, see #38073. - Correctly marks an active plugin as active, even when editing files in subdirectories.
Unfortunately plugin-editor.php
is a mess. There are many many things that should be cleaned up someday, like removing <big>
tags.
#6
in reply to:
↑ 5
;
follow-up:
↓ 7
@
8 years ago
- Component changed from Administration to Plugins
- Focuses administration added
Replying to swissspidy:
35788.diff correctly passes
$plugin
when the main plugin file is needed and$file
when the current file is needed.
This ticket sounds like a duplicate of #17552 and #24122, no?
#7
in reply to:
↑ 6
@
8 years ago
- Milestone 4.7 deleted
- Resolution set to duplicate
- Status changed from new to closed
Replying to SergeyBiryukov:
Replying to swissspidy:
35788.diff correctly passes
$plugin
when the main plugin file is needed and$file
when the current file is needed.
This ticket sounds like a duplicate of #17552 and #24122, no?
Ugh, it absolutely is. Thanks!
Creation of $current_plugin var + better code flavor