Пример #1
0
function can_access_tab($profile_tab, $viewer_id, $owner_id)
{
    bb_log_deprecated('function', __FUNCTION__, 'bb_can_access_tab');
    return bb_can_access_tab($profile_tab, $viewer_id, $owner_id);
}
Пример #2
0
function bb_add_profile_tab($tab_title, $users_cap, $others_cap, $file, $arg = false)
{
    global $profile_menu, $profile_hooks, $user_id;
    $arg = $arg ? $arg : $tab_title;
    $profile_tab = array($tab_title, $users_cap, $others_cap, $file, $arg);
    $profile_menu[] = $profile_tab;
    if (bb_can_access_tab($profile_tab, bb_get_current_user_info('id'), $user_id)) {
        $profile_hooks[bb_sanitize_with_dashes($arg)] = $file;
    }
}
function profile_menu()
{
    global $user_id, $profile_menu, $self, $profile_page_title;
    $list = "<ul id='profile-menu'>";
    $list .= "\n\t<li" . ($self ? '' : ' class="current"') . '><a href="' . esc_attr(get_user_profile_link($user_id)) . '">' . __('Profile') . '</a></li>';
    $id = bb_get_current_user_info('id');
    foreach ($profile_menu as $item) {
        // 0 = name, 1 = users cap, 2 = others cap, 3 = file
        $class = '';
        if ($item[3] == $self) {
            $class = ' class="current"';
            $profile_page_title = $item[0];
        }
        if (bb_can_access_tab($item, $id, $user_id)) {
            if (file_exists($item[3]) || is_callable($item[3])) {
                $list .= "\n\t<li{$class}><a href='" . esc_attr(get_profile_tab_link($user_id, $item[4])) . "'>{$item[0]}</a></li>";
            }
        }
    }
    $list .= "\n</ul>";
    echo $list;
}