`<?php
$ajax = bp_ajax_querystring( ‘activity’);
$qs = !empty($ajax)? $ajax : ‘activity&scope=groups&object=groups’;
if ( bp_has_activities( $qs ) ) :
?>
`
This also works for other loops like groups-loop.php.
Info about the parameters that can be used in $qs are described in the bp_has_activities() documentation