<?php

/*
 * F9 Menu Buttons
 * @version 1.0
 *
 * blah blah MIT or whatever idc
 */

if (!defined('SMF'))
    die('nice try, dodongo');

function hook_f9_buttons(&$buttons)
{
    global $context, $scripturl;
    $search_idx = 0;
    foreach (array_keys($buttons) as $key) {
        $search_idx++;
        if ($key == 'search') {
            break;
        }
    }
    $new_buttons = array(
        'profile' => array(
            'title' => 'Profile',
            'href' => $scripturl . '?action=profile;u=' . $context['user']['id'],
            'show' => !empty($context['user']['is_logged']),
            'sub_buttons' => array(
            ),
        ),
        'ucp' => array(
            'title' => 'Settings',
            'href' => $scripturl . '?action=profile;area=account;u=' . $context['user']['id'],
            'show' => !empty($context['user']['is_logged']),
            'sub_buttons' => array(
            ),
        ),
    );

    if ($context['allow_pm']) {
        $new_buttons[] = array(
            'title' => 'Messages',
            'href' => $scripturl . '?action=pm',
            'show' => !empty($context['user']['is_logged']),
            'sub_buttons' => array(
            ),
            'amt' => $context['user']['unread_messages'],
        );
    }

    $buttons = array_merge(
        array_slice($buttons, 0, $search_idx, true),
        $new_buttons,
        array_slice($buttons, $search_idx, null, true),
    );
}

?>
