add_submenu_page & __FILE__ problem
Hi, I’m trying to add a page in the wp-admin for my component.
add_submenu_page( 'bp-core.php', __( 'Classifieds Setup', 'classifieds' ), __( 'Classifieds Setup', 'classifieds' ), 2, __FILE__, "bp_classifieds_siteadmin_screen" );
Once in the admin, I have the following problem :
The url of the link is
and should be (like for the other bp components I guess)
Is that a bug of buddypress ??
__FILE__ gives the path like you are getting (see this documentation. I suggest just giving it the name of your plugin. Here’s what I use, for example:
add_submenu_page( 'bp-core.php', __( 'Achievements', 'dp-achievements' ),
__( 'Achievements', 'dp-achievements' ), 1, 'dp-achievements', 'dpa_admin' );
And I get a link that looks like http://example.com/wp-admin/admin.php?page=dp-achievements.
add_submenu_page( 'bp-core.php', __( 'Classifieds Setup', 'classifieds' ), __( 'Classifieds Setup', 'classifieds' ), 2, "bp-classifieds", "bp_classifieds_siteadmin_screen" );
gives me the url
bp-classifieds.php is my main file and is under /plugins…
This might be because it looks as if your wpmu install is *not* on the domain root; I believe you are asking for trouble trying to use wpmu in this way.
Also, it might be in part because it looks like you are using “pretty permalinks”. Try turning those off.
Finally works with
add_submenu_page( 'bp-core.php', __( 'Classifieds Setup', 'classifieds' ), __( 'Classifieds Setup', 'classifieds' ), 1, "bp-classifieds/bp-classifieds-admin.php", "bp_classifieds_siteadmin_screen" );
For others who are frustrated by add_submenu_page – using WPMU2.9.1 BP1.13
to BuddyPress menu in WP-admin
add_submenu_page( 'bp-general-settings', "YOUR MENU", "Your Title ",
'manage_options', 'your-plugin-slug', 'your_function');
add_action( 'admin_menu', 'add_menu_link', 20);
// NOTE the addition of a higher priority seems to solve the problems where
// WPMU starts trying to tell you that you don't have access (url is admin.php/?c=1)
I can’t take credit for this – the solution was here
Thanks for posting my solution
For me its Still not working, The menu slug is getting added after …/wp-admin/menu-slug and hence i am getting page not found after clicking menu…….?????
- The topic ‘add_submenu_page & __FILE__ problem’ is closed to new replies.