Ejemplo n.º 1
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 get_profile_tab_link($id = 0, $tab, $page = 1, $context = BB_URI_CONTEXT_A_HREF)
{
    $user = bb_get_user(bb_get_user_id($id));
    $tab = bb_sanitize_with_dashes($tab);
    if (!$context || !is_integer($context)) {
        $context = BB_URI_CONTEXT_A_HREF;
    }
    if ($tab === 'edit' && !($context & BB_URI_CONTEXT_BB_USER_FORMS)) {
        $context += BB_URI_CONTEXT_BB_USER_FORMS;
    }
    $rewrite = bb_get_option('mod_rewrite');
    if ($rewrite) {
        if ($rewrite === 'slugs') {
            $column = 'user_nicename';
        } else {
            $column = 'ID';
        }
        $page = 1 < $page ? '/page/' . $page : '';
        $r = bb_get_uri('profile/' . $user->{$column} . '/' . $tab . $page, null, $context);
    } else {
        $query = array('id' => $user->ID, 'tab' => $tab, 'page' => 1 < $page ? $page : false);
        $r = bb_get_uri('profile.php', $query, $context);
    }
    return apply_filters('get_profile_tab_link', $r, $user->ID, $context);
}
Ejemplo n.º 3
0
function sanitize_with_dashes($text, $length = 200)
{
    // Multibyte aware
    bb_log_deprecated('function', __FUNCTION__, 'bb_sanitize_with_dashes');
    return bb_sanitize_with_dashes($text, $length);
}
function bb_user_nicename_sanitize($user_nicename, $length = 50)
{
    $_user_nicename = $user_nicename;
    return apply_filters('bb_user_nicename_sanitize', bb_sanitize_with_dashes($user_nicename, $length), $_user_nicename, $length);
}