Find the template for each situation and follow the code.
For example, for groups, create an overload of
buddypress\bp-templates\bp-legacy\buddypress\groups\single\members.php
In that file, remove the href on the avatar.
Replace bp_group_member_link() with a call to a custom function that you write in bp-custom.php.
In that function, add a check for the user’s role.
Example, untested, return link only if member is an admin
function ourweb_bp_group_member_link() {
echo ourweb_bp_get_group_member_link();
}
function ourweb_bp_get_group_member_link() {
global $members_template;
if( is_super_admin( $members_template->member->user_id ) )
return apply_filters( 'bp_get_group_member_link', '<a href="' . bp_core_get_user_domain( $members_template->member->user_id, $members_template->member->user_nicename, $members_template->member->user_login ) . '">' . $members_template->member->display_name . '</a>' );
else
return $members_template->member->display_name;
}