Skip to:
Content
Pages
Categories
Search
Top
Bottom

add_submenu_page & __FILE__ problem

  • Avatar of Grosbouff
    grosbouff
    Participant

    @grosbouff

    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

    .../wordpress-mu/wp-admin/bp-classifieds/bp-classifieds-admin.php

    and should be (like for the other bp components I guess)

    .../wordpress-mu/wp-admin/admin.php?page=bp-classifieds/bp-classifieds-admin.php

    Is that a bug of buddypress ??

    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Avatar of Grosbouff
    grosbouff
    Participant

    @grosbouff

    anyone ?

    Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    __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.

    Avatar of Grosbouff
    grosbouff
    Participant

    @grosbouff

    add_submenu_page( 'bp-core.php', __( 'Classifieds Setup', 'classifieds' ), __( 'Classifieds Setup', 'classifieds' ), 2, "bp-classifieds", "bp_classifieds_siteadmin_screen" );

    gives me the url

    http://127.0.0.1/kine/wordpress-mu/wp-admin/bp-classifieds

    bp-classifieds.php is my main file and is under /plugins…

    Avatar of Grosbouff
    grosbouff
    Participant

    @grosbouff

    …anyone ?

    Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    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.

    Avatar of Grosbouff
    grosbouff
    Participant

    @grosbouff

    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

    function add_menu_link(){

    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

    http://teleogistic.net/2009/10/group-forum-subscription-for-buddypress-1-1/#comment-4582

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    Thanks for posting my solution ;)

    Avatar of wp_harish
    wp_harish
    Member

    @wp_harish

    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…….?????

Viewing 9 replies - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.