/**
     * Outputs the HTML for this widget.
     *
     * @global DPA_Achievement_Template $achievements_template Achievements template tag object
     * @global object $bp BuddyPress global settings
     * @param array $args An array of standard parameters for widgets
     * @param array $instance An array of settings for this widget instance
     * @since 2.0
     */
    function widget($args, $instance)
    {
        global $achievements_template, $bp;
        if ($instance['loggedin_user'] && empty($bp->loggedin_user->id) || !$instance['loggedin_user'] && empty($bp->displayed_user->id)) {
            return;
        }
        if ($instance['loggedin_user']) {
            $user_id = $bp->loggedin_user->id;
        } else {
            $user_id = $bp->displayed_user->id;
        }
        extract($args, EXTR_SKIP);
        if (dpa_has_achievements(array('user_id' => $user_id, 'max' => $instance['limit'], 'populate_extras' => false, 'type' => 'locked'))) {
            echo $before_widget;
            if ($instance['title']) {
                echo $before_title;
                echo esc_html(apply_filters('dpa_widget_title', $instance['title']));
                echo $after_title;
            }
            ?>

			<div class="avatar-block">
				<?php 
            while (dpa_achievements()) {
                dpa_the_achievement();
                ?>
					<div class="item-avatar">
						<a href="<?php 
                dpa_achievement_slug_permalink();
                ?>
"><?php 
                dpa_achievement_picture();
                ?>
</a>
					</div>
				<?php 
            }
            ?>
			</div>

		<?php 
            echo $after_widget;
        }
        $achievements_template = null;
    }
do_action('dpa_after_achievement_item_actions');
?>
</div><!-- #item-actions -->

<div id="item-header-avatar" style="<?php 
if (dpa_get_achievement_action_count() <= 1 || dpa_get_achievement_counter() < 1) {
    echo 'margin-bottom: 25px;';
}
?>
">
	<a href="<?php 
dpa_achievement_slug_permalink();
?>
">
		<?php 
dpa_achievement_picture('full');
?>
	</a>
	<?php 
if (dpa_get_achievement_action_count() > 1 && dpa_get_achievement_counter() >= 1) {
    ?>
		<div id="progress-bar" title="<?php 
    dpa_achievement_progress_bar_alt_text();
    ?>
" alt="<?php 
    dpa_achievement_progress_bar_alt_text();
    ?>
" style="width: <?php 
    dpa_achievement_picture_width();
    ?>
px"><div style="width: <?php 
	<ul id="achievements-list" class="item-list">
	<?php 
    while (dpa_achievements()) {
        dpa_the_achievement();
        ?>

		<li class="<?php 
        dpa_achievement_directory_class();
        ?>
">
			<div class="item-avatar">
				<a href="<?php 
        dpa_achievement_slug_permalink();
        ?>
"><?php 
        dpa_achievement_picture();
        ?>
</a>
				<p style="width: <?php 
        dpa_achievement_picture_width();
        ?>
px" title="<?php 
        printf(__("This Achievement is worth %s points.", 'dpa'), bp_core_number_format(dpa_get_achievement_points()));
        ?>
"><?php 
        dpa_achievement_points();
        ?>
</p>
			</div>

			<div class="item">