function bp_link_last_active()
{
    echo bp_get_link_last_active();
}
function bp_links_ajax_widget_links_list()
{
    global $bp;
    check_ajax_referer('bp_links_widget_links_list');
    switch ($_POST['filter']) {
        case 'newest-links':
            $type = 'newest';
            break;
        case 'active-links':
            $type = 'active';
            break;
        case 'popular-links':
            $type = 'popular';
            break;
        case 'most-votes':
            $type = 'most-votes';
            break;
        case 'high-votes':
            $type = 'high-votes';
            break;
    }
    if (bp_has_links('type=' . $type . '&per_page=' . $_POST['max_links'] . '&max=' . $_POST['max_links'])) {
        ?>
		<?php 
        echo "0[[SPLIT]]";
        ?>

		<ul id="links-list" class="item-list">
			<?php 
        while (bp_links()) {
            bp_the_link();
            ?>
				<li>
					<div class="item-avatar">
						<a href="<?php 
            bp_link_permalink();
            ?>
"><?php 
            bp_link_avatar(array('width' => bp_core_avatar_thumb_width(), 'height' => bp_core_avatar_thumb_height()));
            ?>
</a>
					</div>

					<div class="item">
						<div class="item-title"><a href="<?php 
            bp_link_permalink();
            ?>
" title="<?php 
            bp_link_name();
            ?>
"><?php 
            bp_link_name();
            ?>
</a></div>
						<div class="item-meta">
							<span class="activity">
								<?php 
            if ('newest-links' == $_POST['filter']) {
                printf(__('created %s', 'buddypress'), bp_get_link_time_since_created());
            } else {
                if ('active-links' == $_POST['filter']) {
                    printf(__('active %s', 'buddypress-links'), bp_get_link_last_active());
                } else {
                    if ('popular-links' == $_POST['filter'] || 'high-votes' == $_POST['filter']) {
                        printf(__('%+d rating', 'buddypress-links'), bp_get_link_vote_total());
                    } else {
                        printf(__('%s votes', 'buddypress-links'), bp_get_link_vote_count());
                    }
                }
            }
            ?>
							</span>
						</div>
					</div>
				</li>

			<?php 
        }
        ?>
		</ul>
		<?php 
        wp_nonce_field('bp_links_widget_links_list', '_wpnonce-links');
        ?>
		<input type="hidden" name="links_widget_max" id="links_widget_max" value="<?php 
        echo attribute_escape($_POST['max_links']);
        ?>
" />

	<?php 
    } else {
        ?>

		<?php 
        echo "-1[[SPLIT]]<li>" . __("No links matched the current filter.", 'buddypress-links');
        ?>

	<?php 
    }
}
Example #3
0
<h2><a href="<?php 
bp_link_url();
?>
" title="<?php 
bp_link_name();
?>
" target="_blank"><?php 
bp_link_name();
?>
</a></h2>
<span class="highlight"><?php 
bp_link_type();
?>
</span> <span class="activity"><?php 
printf(__('active %s', 'buddypress'), bp_get_link_last_active());
?>
</span>

<?php 
do_action('bp_before_link_header_meta');
?>

<div id="item-meta">
	<?php 
if (bp_get_link_has_description()) {
    ?>
	<span class="domain"><?php 
    bp_link_url_domain();
    ?>
 --</span>