WordPress.org

Ready to get started?Download WordPress

Forums

WP-Table Reloaded
[resolved] wp_table_reloaded_admin_menu_parent_page woes (13 posts)

  1. niklasbr
    Member
    Posted 1 year ago #

    As far as I understand the documentation, this should move the WP-Table Reloaded menu to the upload.php (Media) section of the admin menu, but instead it moves WP-Table Reloaded to the Tools menu.

    add_filter('wp_table_reloaded_admin_menu_parent_page', 'nbr_move_wp_table_reloaded');
    function nbr_move_wp_table_reloaded($admin_menu_page) {
        return "upload.php";
    }

    As a side note I wonder if it is possible to make it a top menu item (my users request it)?

    http://wordpress.org/extend/plugins/wp-table-reloaded/

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    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

  3. niklasbr
    Member
    Posted 1 year ago #

    Using top level with return "admin.php"; does nothing, it just keeps it below the separator under options-general.php.

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    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

  5. niklasbr
    Member
    Posted 1 year ago #

    HIgher up towards the top, like above upload.php.

  6. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    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

  7. niklasbr
    Member
    Posted 1 year ago #

    How high can I move it?

  8. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    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

  9. niklasbr
    Member
    Posted 1 year ago #

    Can I put in a feature request or pledge a donation for this feature?

  10. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    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

  11. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    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

  12. niklasbr
    Member
    Posted 1 year ago #

    Thanks!

  13. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    sure, no problem! You are very welcome!

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic