Introduce BP_Group_Documents::where_id_sql()

This allows us to dedupe some of the logic.