Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [NEXT] - 2026-

- Added: UserModel address getters for BRP API v2 (`street()`, `city()`, `houseNumberAddition()`, `nummeraanduidingIdentificatie()`)
- Added: number of residents at the residential address via BRP search query `ZoekMetNummeraanduidingIdentificatie` (`PostController::countResidents()`, `UserModel::residentsCount()`)
- Added: mappable field "Aantal bewoners" in the Gravity Forms field mapping (v2 suppliers) and the Personal Data Row block
- Fix: `zipcode()`, `houseNumber()` and `houseLetter()` of the UserModel now return values for BRP API v2 responses

## [v2.1.2] - 2026-11-17

- Fix: use general goal binding when a form has no goal binding (V2 suppliers)
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ if ( $user->isLoggedIn() ) {
}
```

### Available methods

| Method | Returns |
|---|---|
| `isLoggedIn()` | `true` when a valid BSN is available |
| `bsn()`, `age()` | BSN and age |
| `initials()`, `firstNames()`, `lastNamePrefix()`, `lastName()`, `fullName(bool $withInitials = false)` | Name parts |
| `street()`, `houseNumber()`, `houseLetter()`, `houseNumberAddition()`, `zipcode()`, `city()` | Residential address |
| `nummeraanduidingIdentificatie()` | BAG identification (16 digits) of the residential address, or `''` |
| `residentsCount()` | Number of persons registered at the residential address, or `null` (see below) |

When no goal binding is given (for example a Personal Data Row block without one), the count uses the general goal binding from the settings. `residentsCount()` uses the BRP search query `ZoekMetNummeraanduidingIdentificatie` and is only available for HaalCentraal BRP API v2 suppliers (e.g. `PinkRoccadeV2`, `EnableUV2`). It returns `null` when the user is not logged in, no address is known, a v1 supplier is configured or the request fails (e.g. a 403 because the goal binding does not allow the search). Only the count is cached (encrypted, one hour, requires `PG_CACHE_ENCRYPTION_KEY`); the persons in the response are discarded.

The address methods read the HaalCentraal BRP API v2 structure (`verblijfplaats.verblijfadres.*`) first and fall back to the v1 structure. All address methods return an empty string when no address is known (e.g. a `Locatie` without address).

This model does not handle authentication itself, it only exposes data retrieved by the underlying BRP supplier controller.
If a controller fails to load (e.g., misconfiguration or missing supplier), the model gracefully returns default values.

Expand All @@ -109,6 +124,15 @@ Each Personal Data Row block must be configured in the block sidebar:
| Processing (Verwerking) | Optional for HaalCentraal API v2. Describes for which work process or process step the BRP data is being requested. |
| Personal data field | The specific BRP attribute to display (e.g. name, date of birth). |

### Number of residents

The field **Aantal bewoners** (`aantalBewoners`) shows the number of persons registered at the residential address of the logged-in user. It is available in the Personal Data Row block ("Aantal bewoners (V2)") and in the Gravity Forms field mapping of the HaalCentraal v2 suppliers (group "Verblijfplaats").

- Only for HaalCentraal BRP API v2 suppliers; the goal binding must allow the search query `ZoekMetNummeraanduidingIdentificatie`. Otherwise the field stays empty and the failure is logged.
- In Gravity Forms, map it to a **Text** field; Number and Hidden fields are not prefilled.
- A count of `0` is shown as empty.
- The count is only requested when a form field is mapped to it.

## Logging

Enable logging to monitor errors during communication with the BRP suppliers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return ['dependencies' => ['react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'], 'version' => 'df0a722bfd18e3eb3f64'];
<?php return ['dependencies' => ['react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'], 'version' => '4b40b98f30dca0b0680b'];
2 changes: 1 addition & 1 deletion build/personal-data-table/personal-data-row/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ const personalDataOptions = [
label: 'Woonplaats naam',
value: 'verblijfplaats.woonplaatsnaam',
},
{
label: 'Aantal bewoners (V2)',
value: 'aantalBewoners',
},
];

export default personalDataOptions;
1 change: 1 addition & 0 deletions resources/views/partials/gf-field-options-enable-u-v2.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<option value="adressering.adresregel2"><?php _e('Postcode + plaats', 'prefill-gravity-forms'); ?></option>
<option value="gemeenteVanInschrijving.omschrijving"><?php _e('Gemeente', 'prefill-gravity-forms'); ?></option>
<option value="gemeenteVanInschrijving.code"><?php _e('Gemeentecode', 'prefill-gravity-forms'); ?></option>
<option value="aantalBewoners"><?php _e('Aantal bewoners', 'prefill-gravity-forms'); ?></option>
</optgroup>
<optgroup label="Huwelijk/Partnerschap-gegevens">
<option value="partners.0.soortVerbintenis.omschrijving"><?php _e('Soort verbintenis', 'prefill-gravity-forms'); ?></option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<option value="adressering.adresregel2"><?php _e('Postcode + plaats', 'prefill-gravity-forms'); ?></option>
<option value="gemeenteVanInschrijving.omschrijving"><?php _e('Gemeente', 'prefill-gravity-forms'); ?></option>
<option value="gemeenteVanInschrijving.code"><?php _e('Gemeentecode', 'prefill-gravity-forms'); ?></option>
<option value="aantalBewoners"><?php _e('Aantal bewoners', 'prefill-gravity-forms'); ?></option>
</optgroup>
<optgroup label="Huwelijk/Partnerschap-gegevens">
<option value="partners.0.soortVerbintenis.omschrijving"><?php _e('Soort verbintenis', 'prefill-gravity-forms'); ?></option>
Expand Down
Loading