<div id="activity-stream" class="activity single-user communityally-shortcode-activity-stream communityally-shortcode-element" data-bp-list="activity">
	<ul class="activity-list item-list bp-list">
	<?php
global $activities_template;
$r = array(
	'display_comments' => 'threaded',
	'show_hidden' => 'true',
	'include' => $activity_id,
	);
if ( !empty($activity_id) && bp_has_activities( $r )) :
?>

	<?php
	while ( bp_activities() ) :
		bp_the_activity();
		$activity = $activities_template->activity;
		if ('groups' === $activity->component) {
			$group_id = $activity->item_id;
			$can_access = CommunityAlly_Groups_Setup::can_user_view_group($group_id);
			if (!$can_access) {
				?>
				<aside class="bp-feedback bp-messages info">
					<span class="bp-icon" aria-hidden="true"></span>
					<p><?php esc_html_e("Sorry, you don't have permission to view this activity.", 'communityally'); ?></p>
				</aside>
				<?php
				continue;
			}
		}
	?>

		<?php bp_get_template_part( 'activity/entry' ); ?>

	<?php endwhile; ?>

<?php else : ?>

	<aside class="bp-feedback bp-messages info">
		<span class="bp-icon" aria-hidden="true"></span>
		<p><?php esc_html_e('Sorry, the activity no longer exists.', 'communityally'); ?></p>
	</aside>

<?php endif; ?>

	</ul>
</div><!-- .activity -->
