Hi,
yes, in theory it would work like that.
The problem here is, that “upload.php” is not in the “white list” (see $possible_admin_menu_parent_pages
in line 87 of controller-base.php), for some reason… And if the value is not that in that list, it gets defaulted to “tools.php”.
Now, as you actually seem to want the entry as a top menu item anyway, here’s how to do that: Either use “admin.php” as the return value, or (which might be simpler) just select “Top-level” in the “Admin Menu entry” dropdown list on the “Plugin Options” screen. Using that is much simpler than using a filter hook 🙂
Best wishes,
Tobias
Thread Starter
Niklas
(@niklasbr)
Using top level with return “admin.php”; does nothing, it just keeps it below the separator under options-general.php.
Hi,
and isn’t that a top-level menu entry then? In my understanding it is… Or where were you expecting the menu entry, and where do you want it?
Regards,
Tobias
Thread Starter
Niklas
(@niklasbr)
HIgher up towards the top, like above upload.php.
Hi,
ah ok, I see. Sorry that I have to disappoint you, but with the current implementation of the menu integration, this is not possible for WP-Table Reloaded at this time. 🙁
Best wishes,
Tobias
Hi,
as I said, this is not possible with WP-Table Reloaded. You would have to manually manipulate the global $menu
array, which is the variable where WordPress stores the admin menu setup.
Regards,
Tobias
Thread Starter
Niklas
(@niklasbr)
Can I put in a feature request or pledge a donation for this feature?
Hi,
I’ll add this to my feature ideas list, and donations are always welcome to further support the development and support of the plugin, but I can’t promise anything right now.
Now, after checking the WordPress core code again, I think there might be a possibility for you. It is a little bit ugly, as it (currently) requires that you slightly modify a file in WP-Table Reloaded (because there’s no filter hook for this), but I guess that you can live with that. You would just have to repeat this modification after WP-Table Reloaded is updated. The necessary change:
In the file “controllers/controller-admin.php”, change line 213 to
$this->hook = add_menu_page( 'WP-Table Reloaded', $display_name, $min_capability, $this->page_slug, array( &$this, 'show_manage_page' ), plugins_url( 'admin/plugin-icon-small.png', WP_TABLE_RELOADED__FILE__ ), 9 );
(Note the additional parameter 9
at the end of the line. The “Media” menu item is position 10
, so the value 9
should move WP-Table Reloaded before the “Media” item.)
Also, for this to work, your filter above needs to return “admin.php” (or just select “Top-level” in the “Plugin Options”, as you won’t need the filter then).
Regards,
Tobias
Hi again,
a different solution might be to use the “Admin Menu Editor” plugin from http://wordpress.org/extend/plugins/admin-menu-editor/ , which seems to allow you to move the menu items.
I didn’t test this though.
Regards,
Tobias
Hi,
sure, no problem! You are very welcome!
Best wishes,
Tobias