plugin / prefill-gravity-forms
Prefill GravityForms Plugin
Package info
github.com/OpenWebconcept/plugin-prefill-gravity-forms
Type:wordpress-plugin
pkg:composer/plugin/prefill-gravity-forms
Requires
- php: ^8.1
- monolog/monolog: ^3.0
- owc/idp-userdata: ^1.0
- php-di/php-di: ^7.0
Requires (Dev)
- 10up/wp_mock: ^0.5.0
- friendsofphp/php-cs-fixer: ^3.0
- mockery/mockery: ^1.0
- phpunit/phpunit: ^9.0
- szepeviktor/phpstan-wordpress: ^1.0
- dev-main
- v2.0.0
- v1.9.1
- v1.9.0
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.10
- v1.7.9
- v1.7.8
- v1.7.7
- v1.7.6
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.11
- v1.6.10
- v1.6.9
- v1.6.8
- v1.6.7
- v1.6.6
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.1
- v1.2.0
- v1.1
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- dev-dependabot/composer/composer-2b718699ed
- dev-dependabot/github_actions/actions-e24c266ee1
- dev-feat/php8-upgrade
This package is auto-updated.
Last update: 2026-06-03 13:16:17 UTC
README
Description
Prefill GravityForms fields, based on the Dutch BSN number. Retrieve personal information and place these values in the corrensponding fields.
Dependencies
To use this plug-in, the following dependencies are required:
- GravityForms (premium)
In addition, at least one of the following plug-ins must be installed to enable authentication by BSN:
- Yard | GravityForms DigiD (https://github.com/yardinternet/owc-gravityforms-digid)
- OWC Signicat OpenID (https://github.com/yardinternet/plugin-owc-signicat-openid)
Features
- Map GravityForms fields to attributes retrieved from the configured supplier.
- Mapped fields will be prefilled while rendering a form.
- Gutenberg block for displaying personal data of the current logged in user.
Installation
Manual installation
- Upload the 'prefill-gravity-forms' folder in to the
/wp-content/plugins/directory. cd /wp-content/plugins/prefill-gravity-forms- Run `composer install, NPM asset build is in version control already.
- Activate the plugin in via the WordPress admin.
Composer installation
composer source git@github.com:OpenWebconcept/plugin-prefill-gravity-forms.gitcomposer require plugin/prefill-gravity-formscd /wp-content/plugins/prefill-gravity-forms- Run
composer install, NPM asset build is in version control already.
Setup
- Go to '/wp-admin/admin.php?page=gf_settings&subview=owc-gravityforms-iconnect' and configure all the required settings.
-
- Suppliers will provide the needed certificates which need to be selected in order to make prefilling form fields work.
-
- Suppliers will also provide an API-key, certificates password (if needed) and a base URL.
-
- OIN is a unique number for organizations provided by Logius.
- Go to the form settings of the form you want to configure.
- Scroll down and look for the 'OWC Prefill' panel and configure the settings.
Cache Encryption
To enable secure caching of sensitive data, you must define an encryption key in your wp-config.php file. This key is used to encrypt and decrypt the cached data and should be kept secret at all times.
Add the following line to your wp-config.php:
// Prefill Gravity Forms – Cache Encryption Key define('PG_CACHE_ENCRYPTION_KEY', 'your-unique-32-character-key');
Important:
- Use a randomly generated, 32-character key for strong AES-256 encryption.
- Never store this key in the database.
- Keep it secret and secure — anyone with access to this key can decrypt cached data.
License
The source code is made available under the EUPL 1.2 license. Some of the dependencies are licensed differently, with the BSD or MIT license, for example.
User model
The UserModel provides a simple way to access BRP (Basisregistratie Personen) data that has been retrieved after a valid DigiD login.
It automatically detects which data supplier is configured (in the add-on settings), loads the correct controller, and exposes a small set of helper methods for use in templates or form-prefill logic.
Before accessing any user attributes, always check whether the user is authenticated using DigiD.
Usage
$user = new \OWC\PrefillGravityForms\Models\UserModel(); if ( $user->isLoggedIn() ) { $bsn = $user->bsn(); $age = $user->age(); }
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.
To use this model, make sure it is enabled in the settings available at '/wp-admin/admin.php?page=gf_settings&subview=owc-gravityforms-iconnect'. Otherwise, the object will be instantiated but will not contain any data.
Gutenberg blocks
This plugin ships with two Gutenberg blocks for displaying personal data of the logged-in user on any page.
- Personal Data Table (
owc-prefill-gravity-forms/personal-data-table) — a container block that wraps rows in an HTML table (<table>). - Personal Data Row (
owc-prefill-gravity-forms/personal-data-row) — displays a single personal data field. When placed inside the table block it renders as a<tr>, otherwise as a configurable HTML element (<div>,<p>, or<span>).
Each Personal Data Row block must be configured in the block sidebar:
| Setting | Description |
|---|---|
| Supplier | Must match the supplier configured in the plugin settings. |
| Goal binding | Required for HaalCentraal API v2 — determines which fields are returned. |
| Processing | Optional processing context for HaalCentraal API v2. |
| Personal data field | The specific BRP attribute to display (e.g. name, date of birth). |
Logging
Enable logging to monitor errors during communication with the BRP suppliers.
- Logs are written daily to
pg-log{-date}.jsonin the WordPress webroot directory. - A rotating file handler keeps up to 7 log files by default, deleting the oldest as needed.
- You can change the maximum number of log files using the filter described below.
Hooks
Change the maximum number of log files
Use the following filter to alter the rotating file handler's max files setting:
apply_filters('pg::logger/rotating_filer_handler_max_files', PG_LOGGER_DEFAULT_MAX_FILES)
Intercept exceptions for custom handling
You can intercept exceptions caught by the plugin for additional processing or custom logging using this filter:
do_action('pg::exception/intercept', $exception, $method)
The $exception parameter contains the caught exception object.
Provide Custom Mapping Options from a Theme Directory
This plugin includes supplier-specific mapping option files. In version 1 of the "HaalCentraal API", all available fields were returned, even when only a subset was needed.
Since version 2 of HaalCentraal, this has changed: the goal binding (doelbinding) now determines which fields are returned. This results in a more concise dataset that contains only the necessary fields. Because each municipality (gemeente) can define its own unique goal bindings and corresponding fields, this plugin cannot include all possible mapping configurations by default.
add_filter('pg::theme/dir_mapping_options', function ($value) { return __DIR__ . '/templates/owc-prefill/'; }, 10, 1);