Skip to content

Commit

Permalink
* Checks for existence of parent settings menu before overwriting it
Browse files Browse the repository at this point in the history
* * TSP Plugins menu page may be duplicated when additional plugins added
Ticket #FP-3
  • Loading branch information
sharrondenice committed Jul 15, 2013
1 parent cca1a7c commit 68750d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: http://www.thesoftwarepeople.com/software/plugins/wordpress/feature
Tags: featured posts display gallery slider jquery moving boxes the software people
Requires at least: 3.5.1
Tested up to: 3.5.2
Stable tag: 1.0.0
Stable tag: 1.0.1
License: Apache v2.0
License URI: http://www.apache.org/licenses/LICENSE-2.0

Expand Down
14 changes: 12 additions & 2 deletions includes/settings.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,18 @@ function fn_tspfp_register_settings() {

function fn_tspfp_add_admin_menu()
{
add_menu_page( 'TSP Plugins', 'TSP Plugins', 'manage_options', 'tsp_plugins', 'fn_tsp_plugins_add_menu_render', WP_CONTENT_URL."/plugins/tsp-featured-posts/images/tsp_icon_16.png", 2617638);
add_submenu_page('tsp_plugins', __( 'Featured Posts', 'tsp-featured-posts' ), __( 'Featured Posts', 'tsp-featured-posts' ), 'manage_options', "tsp-featured-posts.php", 'fn_tspfp_settings_page');
$parent_slug = 'tsp_plugins';
$child_slug = 'tsp-featured-posts.php';

if ( !menu_page_url( $parent_slug, false ) )
{
add_menu_page( 'TSP Plugins', 'TSP Plugins', 'manage_options', $parent_slug, 'fn_tsp_plugins_add_menu_render', WP_CONTENT_URL."/plugins/tsp-featured-posts/images/tsp_icon_16.png", 2617638);
}//endif

if ( !menu_page_url( $menu_slug, false ) )
{
add_submenu_page($parent_slug, __( 'Featured Posts', 'tsp-featured-posts' ), __( 'Featured Posts', 'tsp-featured-posts' ), 'manage_options', $child_slug, 'fn_tspfp_settings_page');
}//endif

//call register settings function
add_action( 'admin_init', 'fn_tspfp_register_settings' );
Expand Down

0 comments on commit 68750d8

Please sign in to comment.