Example #1
0
?>

		<?php 
if (bp_activity_user_can_delete()) {
    ?>

			<a href="<?php 
    bp_activity_comment_delete_link();
    ?>
" class="delete acomment-delete confirm bp-secondary-action" rel="nofollow"><?php 
    _e('Delete', 'buddypress');
    ?>
</a>

		<?php 
}
?>

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

	</div>

	<?php 
bp_activity_recurse_comments(bp_activity_current_comment());
?>
</li>

<?php 
do_action('bp_after_activity_comment');
/**
 * Gets the comment markup for an activity item
 *
 * @since 1.2.0
 *
 * @todo deprecate $args param
 *
 * @todo Given that checks for children already happen in bp_activity_recurse_comments(),
 *    this function can probably be streamlined or removed.
 *
 * @param string $args Unused. Appears to be left over from an earlier implementation.
 *
 * @global object $activities_template {@link BP_Activity_Template}
 * @global object $bp BuddyPress global settings
 * @uses bp_activity_recurse_comments()
 */
function bp_activity_get_comments($args = '')
{
    global $activities_template, $bp;
    if (!isset($activities_template->activity->children) || !$activities_template->activity->children) {
        return false;
    }
    bp_activity_recurse_comments($activities_template->activity);
}
/**
 * Get the comment markup for an activity item.
 *
 * @since 1.2.0
 *
 * @todo deprecate $args param
 * @todo Given that checks for children already happen in bp_activity_recurse_comments(),
 *       this function can probably be streamlined or removed.
 *
 * @global object $activities_template {@link BP_Activity_Template}
 * @uses bp_activity_recurse_comments()
 *
 * @param string $args Unused. Left over from an earlier implementation.
 * @return bool
 */
function bp_activity_get_comments($args = '')
{
    global $activities_template;
    if (empty($activities_template->activity->children)) {
        return false;
    }
    bp_activity_recurse_comments($activities_template->activity);
}
function bp_swa_activity_recurse_comments($comment)
{
    global $activities_template, $bp;
    if (!$comment->children) {
        return false;
    }
    $content .= '<ul>';
    foreach ((array) $comment->children as $comment) {
        if (!$comment->user_fullname) {
            $comment->user_fullname = $comment->display_name;
        }
        $content .= '<li id="swa-acomment-' . $comment->id . '">';
        $content .= '<div class="swa-acomment-avatar"><a href="' . bp_core_get_user_domain($comment->user_id, $comment->user_nicename, $comment->user_login) . '">' . bp_core_fetch_avatar(array('item_id' => $comment->user_id, 'width' => 25, 'height' => 25, 'email' => $comment->user_email)) . '</a></div>';
        $content .= '<div class="swa-acomment-meta"><a href="' . bp_core_get_user_domain($comment->user_id, $comment->user_nicename, $comment->user_login) . '">' . apply_filters('bp_get_member_name', $comment->user_fullname) . '</a> &middot; ' . sprintf(__('%s ago', 'swa'), bp_core_time_since(strtotime($comment->date_recorded)));
        /* Delete link */
        if ($bp->loggedin_user->is_site_admin || $bp->loggedin_user->id == $comment->user_id) {
            $content .= ' &middot; <a href="' . wp_nonce_url($bp->root_domain . '/' . $bp->activity->slug . '/delete/?cid=' . $comment->id, 'bp_activity_delete_link') . '" class="delete acomment-delete">' . __('Delete', 'swa') . '</a>';
        }
        $content .= '</div>';
        $content .= '<div class="swa-acomment-content">' . apply_filters('bp_get_activity_content', $comment->content) . '</div>';
        $content .= bp_activity_recurse_comments($comment);
        $content .= '</li>';
    }
    $content .= '</ul>';
    return apply_filters('bp_swa_activity_recurse_comments', $content);
}
		function bp_activity_recurse_comments( $comment ) {
			global $activities_template, $bp;

			if ( !$comment->children )
				return false;

			$content .= '<ul>';
			foreach ( (array)$comment->children as $comment ) {
				if ( !$comment->user_fullname )
					$comment->user_fullname = $comment->display_name;

				$content .= '<li id="acomment-' . $comment->id . '">';
				$content .= '<div class="acomment-avatar"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'width' => 20, 'height' => 20, 'email' => $comment->user_email ) ) . '</a></div>';
				$content .= '<div class="acomment-meta"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . apply_filters( 'bp_acomment_name', $comment->user_fullname, $comment ) . '</a> &middot; ' . sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( $comment->date_recorded ) );

				/* Reply link - the span is so that threaded reply links can be hidden when JS is off. */
				if ( is_user_logged_in() )
					$content .= '<span class="acomment-replylink"> &middot; <a href="#acomment-' . $comment->id . '" class="acomment-reply" id="acomment-reply-' . $activities_template->activity->id . '">' . __( 'Reply', 'buddypress' ) . '</a></span>';

				/* Delete link */
				if ( $bp->loggedin_user->is_super_admin || $bp->loggedin_user->id == $comment->user_id )
					$content .= ' &middot; <a href="' . wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/?cid=' . $comment->id, 'bp_activity_delete_link' ) . '" class="delete acomment-delete">' . __( 'Delete', 'buddypress' ) . '</a>';

				$content .= '</div>';
				$content .= '<div class="acomment-content">' . apply_filters( 'bp_get_activity_content', $comment->content ) . '</div>';

				$content .= bp_activity_recurse_comments( $comment );
				$content .= '</li>';
			}
			$content .= '</ul>';

			return apply_filters( 'bp_activity_recurse_comments', $content );
		}