Adding a Dashboard Panel

Applies to: Jamroom 7.0+ Last verified: 2026-10-24
  • Dashboard panels

    The Dashboard (ACP > Dashboard) shows panels of numbers, such as members online or the image cache size. Admins choose the panels: Customize adds rows and columns, and clicking an empty panel offers every panel modules provide.

  • Providing a panel

    Register the panel in _init(), with its title and the function that fills it:

    jrCore_register_module_feature('jrCore', 'dashboard_panel', 'xxFoo', 'open tickets', 'xxFoo_dashboard_panels');
  • The function gets the panel title. It returns an array with the panel's title, the value shown, or false:

    function xxFoo_dashboard_panels($panel)
    {
        switch ($panel) {
            case 'open tickets':
                $cnt = jrCore_db_run_key_function('xxFoo', 'foo_status', 'open', 'count');
                return array('title' => jrCore_number_format(intval($cnt)));
        }
        return false;
    }
  • One function can serve several panels, with a switch on the title, as the Image Support module does for its image cache size and cached image count panels.

  • Keep it fast

    The Dashboard loads every panel on each view. Cache slow values for a short time:

    if ($out = jrCore_is_cached('xxFoo', $panel, false, false)) {
        return $out;
    }
    // ... work out $out ...
    jrCore_add_to_cache('xxFoo', $panel, $out, 30, 0, false, false);
  • (30 is the seconds to keep it.)

Tags