「total_of_groups」が 0 でない場合、既存の選択ボックスに次のオプションを追加します。
<option value="groupmembers" <?php echo selected('groupmembers',bp_profile_visibility_get_settings($user_id,'bp_profile_visibility' ));?>><?php _e('Group Members Only','bp-profile-visibility');?></option>
残念ながら、うまくいきません。選択範囲外でコード スニペットをテストしましたが、完璧に動作します。
<select name="bp_profile_visibility">
<option value="public" <?php echo selected('public',bp_profile_visibility_get_settings($user_id,'bp_profile_visibility' ));?>><?php _e('Everyone','bp-profile-visibility');?></option>
<option value="friends" <?php echo selected('friends',bp_profile_visibility_get_settings($user_id,'bp_profile_visibility' ));?>><?php _e('Friends Only','bp-profile-visibility');?></option>
// the new option //
<?php
$is_groupmember = BP_Groups_Member::get_group_ids( bp_displayed_user_id() );
$total_of_groups = $is_groupmember[total];
if( $total_of_groups != 0 )
echo <option value="groupmembers" <?php echo selected('groupmembers',bp_profile_visibility_get_settings($user_id,'bp_profile_visibility' ));?>><?php _e('Group Members Only','bp-profile-visibility');?></option>
?>
<option value="self" <?php echo selected('self',bp_profile_visibility_get_settings($user_id,'bp_profile_visibility' ));?>><?php _e('Only Me (private)','bp-profile-visibility');?></option>
</select>