3.8.3. admin_menu

(Phorum 5.2.16)

This hook allows to inject custom HTML into the Phorum admin menu. The hook will receive an instance of PhorumAdminMenuHookPosition which is required to determine at which position in the Phorum admin menu the module author wishes to place his custom menu. Although any HTML can be injected, it is advised to use the PhorumAdminMenu class. Use the methods appendAt(position, html) and appendLast(html) to tell where you want them to appear.

Call time:

Admin header

Hook input:

Object of PhorumAdminMenuHookPosition

Hook output:

Return the object

Example code:

function phorum_mod_foo_admin_menu($pos)
{
    $menu = new PhorumAdminMenu("MyImportantLinks");
    $menu->addCustom(
        "Event log",
        phorum_admin_build_url(array(
            'module=modsettings',
            'mod=event_logging',
            'el_action=logviewer'
        ))
    );
    $menu->addCustom(
        "My module subpage",
        phorum_admin_build_url(array(
            'module=modsettings',
            'mod=foo',
            'action=subpage'
        ))
    );

    $pos->appendLast($menu->getHtml());

    $menu = new PhorumAdminMenu("Who rocks?");
    $menu->addCustom(
        "Guess!",
        "http://phorum.org/",
        "Phorum rocks!",
        "_blank"
    );

    $pos->appendAt(0, $menu->getHtml());

    return $pos;
}