Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding a plugin admin page into the admin menu

  • @null

    Member

    Hi,

    I know that you can add a plugin admin page into the admin menu. Unfortunally I only succeed in doing this into the submenu of the admin page. Is it possible to add a new plugin admin page link to the MAIN menu of the amdin area? (so not into the submenu)

    And how?

    I am currently working on a plugin that has many options and putting them all into the submenu would make it too crowdy/messy

Viewing 13 replies - 1 through 13 (of 13 total)
  • @trent

    Member

    Have you looked at the way the admin pages create the main menu options? That would be the only way off the top of my head that you could figure it out right now.

    Trent

    @null

    Member

    Yeah, I could make another admin page but that will need another extra php file too. It’s more need and tidy to use a hook like in the submenu.

    Going to request some hooks then :)

    @chanzero

    Member

    any result here? (as i’m not adept enough to play with creating this)

    @thierryyyyyyy

    Participant

    in the admin-functions.php, there is the function which creates the main menu (and also submenu) : bb_admin_menu_generator()

    at the end of the function, you have a “hook” that you can use :

    do_action(‘bb_admin_menu_generator’,”);

    I tried this code :

    add_action('bb_admin_menu_generator', 'bbai_add_options');

    function bbai_add_options(){
    $bb_menu[20] = array(__('Options'), 'use_keys', 'my_options_page.php');
    }

    but didn’t worked :(

    @fel64

    Member

    This worked for me:

    add_action('bb_admin_menu_generator', 'contestsmenue');

    function contestsmenue () {
    global $bb_submenu;
    $bb_submenu['content.php'][] = array(__('Contests'), 'moderate', 'contestinnerface');
    }

    @thierryyyyyyy

    Participant

    Thank you fel64.

    it seems that I stupidly forgot the “global $bb_menu”

    thanks a lot !

    @ganzua

    Member

    thierryyyyyyy, I visited your page and I still can feel pain after having watched those holes in your feet. :s

    @thierryyyyyyy

    Participant

    Thanks a lot ganzua, but actually, it does not hurt a lot …

    I confirmed that with “global $bb_menu”, my fonction could work …. but then, the last array member for

    $bb_menu[20] = array(__(‘Options’), ‘use_keys’, ‘my_options_page.php’);

    should be a php file located in bb-admin/

    So then, you should ask guys that want to install your plugin to move your “option-page.php” in the bb-admin menu. Not very user-friendly.

    @fel64

    Member

    You should be using $bb_submenu anyway. It’s unlikely that your plugin justifies making another large menu category.

    @thierryyyyyyy

    Participant

    If bbPress includes a “Plugin” menu or an “Option” menu, it would be natural for all new plugin to have their submenu in it.

    Do you think I can ask that in TRAC ?

    @fel64

    Member

    I believe that Site Management and Content are likely to be best to house the extra panel of a plugin, but sure. If you want to, ask in trac.

    @sambauers

    Participant

    There are functions to do this in the current trunk of subversion. These will be part of 1.0.

    Check how it is done in my LDAP plugin, so that it will degrade gracefully on older versions of bbPress.

    @sambauers

    Participant

    There are functions to do this in the current trunk of subversion. These will be part of 1.0.

    Check how it is done in my LDAP plugin, so that it will degrade gracefully on older versions of bbPress.

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Skip to toolbar