Display only entries relevant to users' country I'm really struggling with displaying news entry that are only relevant to the users' location.

Here is my structure:

User

Country - > is a dropdown with a single value (lets say UK)

Regions is a category that contains

name -> string (for example Europe)

countries -> a checkbox with a list of countries (UK, FR.. etc)

News which has a Region category

So what I have now is this:

{% for entry in craft.entries.section('news') %}
{# loop through regions  #}  
    {% for region in entry.regions %}
        {# loop region's countries  #}
        {% for targetCountry in region.countries %}
            {% if targetCountry == currentUser.country %} 
                {% set visibility = true %}  
            {% endif %}
        {% endfor %}
    {% endfor %}
{% endfor %}


This works, however, since the checking occurs after I get all the entries I can't use pagination. Is there a nicer way of doing this?
One nice way to handle things like this is to collect the ids for all the entries you want, use those ids for the ElementCriteriaModel you need for the pagination, and then paginate.

Collect the ids (use merge to create an array of the ids):

{% set ids = [] %}

{% for entry in craft.entries.section('news') %}
  {# loop through regions  #}  
  {% for region in entry.regions %}
    {# loop region's countries  #}
    {% for targetCountry in region.countries %}
      {% if targetCountry == currentUser.country %} 
        {% set ids = ids | merge([entry.id]) %}  
      {% endif %}
    {% endfor %}
  {% endfor %}
{% endfor %}


Get the entries for pagination:

{% set unpaginated = craft.entries({
  id: ids,
  limit: 10
}) %}


Finally, the pagination:

{% paginate unpaginated as pageInfo, pageEntries %}
...