---
title: "AfterProfileMappedFromFrontendUserEvent"
manual: "Academic Profiles"
version: "main"
permalink: "https://docs.typo3.org/permalink/fgtclb/academic-persons:developers-event-after-profile-mapped-from-frontend-user-event@main"
source: "Developers/Events/AfterProfileMappedFromFrontendUserEvent.rst"
rendered: "2026-10-15T10:24:29+00:00"
---

# AfterProfileMappedFromFrontendUserEvent {#developers-event-after-profile-mapped-from-frontend-user-event}

`\FGTCLB\AcademicPersons\Event\AfterProfileMappedFromFrontendUserEvent`
hands a listener the profile the frontend user synchronisation has just mapped
from the data of a frontend user, before it is saved. A listener translates a
value of the source into one the profile offers, or derives a value from
others. What it sets on the profile and its contracts is saved with it.

## When it is dispatched {#when-it-is-dispatched}

`AbstractProfileFactory` dispatches the event, under the same conditions
as [BeforeProfileMappedFromFrontendUserEvent](https://docs.typo3.org/permalink/fgtclb/academic-persons:developers-event-before-profile-mapped-from-frontend-user-event@main):

-   `academic:createprofiles`: once per frontend user, after the new
    profile was mapped and attached to the frontend user. Not when a listener
    skipped the frontend user, and not when the factory has no profile for it.
-   `academic:updateprofiles`: once per synchronised profile of the
    frontend user, after the profile was mapped. Not for a skipped profile.

It is step 4 of the run described in [Taking part in the frontend user synchronisation](https://docs.typo3.org/permalink/fgtclb/academic-persons:developers-frontend-user-sync-events@main).
The profile is saved and announced with
[AfterProfileUpdateEvent](https://docs.typo3.org/permalink/fgtclb/academic-persons:developers-event-after-profile-update-event@main) afterwards.

## What a listener reads and changes {#what-a-listener-reads-and-changes}

| Method | What it does |
| --- | --- |
| `getProfile()` | The mapped profile. The event has no setter: the listener changes the object, and the change is saved. |
| `getFrontendUserData()` | The data the mapping used, with the values the listeners of `BeforeProfileMappedFromFrontendUserEvent` added. |
| `getAction()` | `ProfileActionType::Create` or `ProfileActionType::Update`. |

## Example {#example}

A site's directory service delivers the gender as `w`, `m` or `d`, added
to the data as `ldap.gender` by the example of
[BeforeProfileMappedFromFrontendUserEvent](https://docs.typo3.org/permalink/fgtclb/academic-persons:developers-event-before-profile-mapped-from-frontend-user-event@main). The
listener translates it into the values the profile offers:

**EXT:my_sitepackage/Classes/EventListener/MapGender.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MySitepackage\EventListener;

use FGTCLB\AcademicPersons\Event\AfterProfileMappedFromFrontendUserEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;

final readonly class MapGender
{
    private const GENDERS = ['w' => 'ms', 'm' => 'mr', 'd' => 'diverse'];

    #[AsEventListener(identifier: 'my-sitepackage/map-gender')]
    public function __invoke(AfterProfileMappedFromFrontendUserEvent $event): void
    {
        $source = (string)($event->getFrontendUserData()['ldap.gender'] ?? '');
        $event->getProfile()->setGender(self::GENDERS[$source] ?? '');
    }
}
```

A listener that sets the employee type of the imported contract from the
frontend user data is described in
[Organisational unit and function type](https://docs.typo3.org/permalink/fgtclb/academic-persons:configuration-frontend-user-sync-relations@main).

## Rules and pitfalls {#rules-and-pitfalls}

-   A value the map writes is written on every run. A listener that changes
    it has to change it on every run as well, or the next run writes the
    mapped value again.
-   The profile is not saved yet. Do not persist it from the listener, the
    factory saves it after all listeners ran.
-   On update the event is dispatched once per profile, so a frontend user
    with two synchronised profiles reaches the listener twice.

## Introduced in {#introduced-in}

-   [Feature: Events to add data to the synchronisation and adjust profiles](https://docs.typo3.org/permalink/fgtclb/academic-persons:feature-frontend-user-sync-data-events@main) introduced the event.
