thomasgriffin/TGM-Plugin-Activation — Issue #63: Allow custom menu entry position in the WP menu
Author: icecaster
Created: 2011-11-22 23:10:08+00:00
State: open

Currently on L284
https://github.com/thomasgriffin/TGM-Plugin-Activation/blob/dev/tgm-plugin-activation/class-tgm-plugin-activation.php#L284

It has "add_theme_page" hardcoded.

It would be great if this could be customised by specifying the page where it would be included.

Looking at the definition of add_theme_page() this would be easy to do by allowing to set one config var:

function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function );
}

change
add_theme_page(

$this->strings['page_title'], // Page title

$this->strings['menu_title'], // Menu title

'edit_theme_options', // Capability

$this->menu, // Menu slug

array( &$this, 'install_plugins_page' ) // Callback

);
to
add_submenu_page(

$this->strings['parent_slug'], // Parent in menu
$this->strings['page_title'], // Page title

$this->strings['menu_title'], // Menu title

'edit_theme_options', // Capability

$this->menu, // Menu slug

array( &$this, 'install_plugins_page' ) // Callback

);

and adding parent_slug to the strings array in the constructor @L123:

$this->strings = array(

'parent_slug'	=> 'themes.php',
...

This would default to current implementation but allow users to choose their own position in the menu.

Thanks