How to make combination of two field values unique? I make use of the front-end entry form for an event registration process. The event is the main entry, and every event registration an entry of a related registration section. The challenge is to see whether a user has already been registered for an event. Today, I do that with a database query before the entry form loads. But for some reason, this works not always (for example when users reload the page). How could I make the combination of two fields ("user id" and "registration status") unique? (Normally, I would do that on a database level with a unique index over the two fields.)
If I understood you correctly, you have two sections:


events
registrations


Is the user logged in? If yes, you can save the user id in your registration entry. In your events template you can check now, if a registration entry exists that is related to this event and the current user. 
See example code (untested).

{% if currentUser %}

   {% set query = "userIdField:"~ currentUser.id %}
   {% set results = craft.entries({
      relatedTo: entry.id,
      section:'registrations'
      search: query
   }) %}

{% endif %}

{% if results|length %}
    user is already registered
{% else %}
    show registration form
{% endif%}


If your user is not logged in, you could (temporarily) store the registration information in a cookie (check out this plugin: https://github.com/lewisjenkins/craft-lj-cookies) and do a similar check.