function bp_get_link_details_form_action()
{
    global $bp;
    if (bp_links_current_link_exists()) {
        $form_action = bp_get_link_admin_form_action();
    } else {
        switch (bp_current_component()) {
            default:
            case bp_links_id():
            case bp_links_slug():
                $form_action = $bp->loggedin_user->domain . bp_links_slug() . '/create';
                break;
        }
    }
    return apply_filters('bp_get_link_details_form_action', $form_action);
}
示例#2
0
					<li class="selected" id="links-all"><a href="<?php 
bp_root_domain();
?>
"><?php 
_e('All Links', 'buddypress-links');
?>
 <span><?php 
echo bp_get_links_total_link_count();
?>
</span></a></li>

					<?php 
if (is_user_logged_in() && bp_links_total_links_for_user(bp_loggedin_user_id())) {
    ?>
						<li id="links-mylinks"><a href="<?php 
    echo bp_loggedin_user_domain() . bp_links_slug() . '/my-links/';
    ?>
"><?php 
    _e('My Links', 'buddypress-links');
    ?>
 <span><?php 
    echo bp_links_total_links_for_user(bp_loggedin_user_id());
    ?>
</span></a></li>
					<?php 
}
?>

					<?php 
do_action('bp_links_directory_link_types');
?>
示例#3
0
/**
 * Filter all AJAX bp_activity_request() calls for the 'activity' object with the 'links' scope
 *
 * @param string $query_string
 * @param string $object
 * @param string $filter
 * @param string $scope
 * @param integer $page
 * @param string $search_terms
 * @param string $extras
 * @return string
 */
function bp_links_dtheme_activity_filter($query_string, $object, $filter, $scope, $page, $search_terms, $extras)
{
    global $bp;
    $do_filter = false;
    // only filter activity.
    if (bp_links_is_activity_enabled() && $bp->activity->id == $object) {
        if (bp_is_user()) {
            // handle filtering for profile pages
            // this nav does not use AJAX so don't rely on $scope
            if (bp_is_activity_component() && bp_links_slug() == $bp->current_action) {
                $do_filter = 'user';
            }
        } else {
            // handle filtering for all non-profile, non-links pages
            if (!bp_current_component() || bp_is_activity_component()) {
                // filter under 'activity' component with 'links' scope
                if (bp_links_id() == $scope) {
                    $do_filter = 'user';
                }
            } elseif (bp_is_links_component()) {
                // filter 'links' component home pages
                if ($bp->is_single_item) {
                    $do_filter = 'default';
                }
            }
        }
    }
    if ($do_filter) {
        // parse query string
        $args = array();
        parse_str($query_string, $args);
        switch ($do_filter) {
            case 'user':
                // override with links object
                $args['object'] = bp_links_id();
                // user_id must be empty to show OTHER user's actions for this user's links
                $args['user_id'] = false;
                // get recent link cloud ids for this user
                $recent_ids = bp_links_recent_activity_item_ids_for_user();
                // if there is activity, send the ids
                if (count($recent_ids)) {
                    $args['primary_id'] = join(',', $recent_ids);
                }
                break;
            case 'default':
                // override with links object
                $args['object'] = bp_links_id();
                // set primary id to current link id if applicable
                if ($bp->links->current_link) {
                    $args['primary_id'] = $bp->links->current_link->id;
                }
                break;
        }
        // return modified query string
        return http_build_query($args);
    }
    // no filtering
    return $query_string;
}
示例#4
0
function bp_links_create_component_id()
{
    $component_id = false;
    // check current component
    switch (bp_current_component()) {
        // Are we at domain.org/links/create ???
        case bp_links_id():
        case bp_links_slug():
            if ('create' == bp_current_action()) {
                $component_id = bp_links_id();
            }
            break;
    }
    return apply_filters('bp_links_create_component_id', $component_id);
}