App using "Wrong" linked data

I have problems linking the data correctly, or how to fetch the right data.

I have two different tables: Users (build-in) and Participant. App’s User is always a “Participant” but there can be a Participant without being an User. The Participant is linked to that User or users team in that case. Users and Participants form a team or group. One or more User can have multiple participants under his account.

Users table

Participants table

Users data

Participants data

Whitened parts are not secrets but are irrelevant to this problem. The problem is:

I have a site that shows the data of some participant for admin to add things to that Participant. I am logged in as a Sippe/hvalijarvi@… (User) who is Herra@herra.fi’s Participant. This is the site of Sippe’s info, data send from previous page (works as it should).

I try to fetch Current users Participant name

…and current sites Participants name

and this is what I get. Upper is wrong. Both should be “Sippe” because the logged in user is Sippe.
image

So it fetches the first info from “Participant” that refers to the group (herra@herra.fi) not the right Users info (Sippe / hvalijarvi@…). At least that is what I think it does.

What I am doing wrong or what needs to be done?